Type: php
Add Custom Attributes and Group Them
// Step 1: Add your custom attribute(s) to a named group function add_custom_grouped_attributes( $attributes ) { // Define your own group label here $group_label = ‘Other fields’; // e.g., ‘Image attributes’, ‘Custom data’, etc. // Initialize group if not set…Continue reading
Clarity
ブロックエディター内でショートコード呼び出し {br-vsp}{br-vpc}
// {br-vsp}{br-vpc}ショートコード function replace_br_vsp_shortcode($content) { $content = str_replace(‘{br-vsp}’, ‘‘, $content); $content = str_replace(‘{br-vpc}’, ‘‘, $content); return $content; } add_filter(‘the_content’, ‘replace_br_vsp_shortcode’, 10);Continue reading
Del 2
Velkommen til Bilerfaring.no Del og les ekte erfaringer med biler i Norge – fra folk som faktisk har eid dem. Toyota Corolla (2015) Driftssikker og billig i drift. Har kjørt 120 000 km uten store problemer. Anbefales! Volkswagen Golf (2018)…Continue reading
Add Unified Product SKU with ID for Facebook Feed || WPML || PFE
function adt_wpml_unified_product_sku_id( $product_data, $feed, $product ) { // Check if the feed is for Facebook dynamic remarketing if( isset($feed->channel[‘fields’]) && $feed->channel[‘fields’] == ‘facebook_drm’ ) { $product_id = $product->get_id(); // Get the original product ID from WPML (default language) $wpml_product_id =…Continue reading
Unified Product ID for Facebook Feed || WPML || PFE
function adt_wpml_unified_product_id( $product_data, $feed, $product ) { // Only run for Facebook dynamic remarketing feed if( isset($feed->channel[‘fields’]) && $feed->channel[‘fields’] == ‘facebook_drm’ ) { // Get current product ID $product_id = $product->get_id(); // Get original product ID from WPML (if exists)…Continue reading
Allow SVG Files Upload
/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading
fix border
disable OptinMonster campaigns for visitors with specific user roles
function om_docs_hide_optin_for_user_roles( $campaigns ) { // Do nothing if no user is logged in. if ( ! is_user_logged_in() ) { return $campaigns; } // Change these as necessary. $roles_to_check = array( ‘administrator’, ‘subscriber’ ); // Get the current user. $user…Continue reading