How to add custom li item to wordpress menu

Default usage of add_filter looks like this: add_filter( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ) As you can see, the default priority is 10 and by default only one param is passed. In your code you need your filter to get 2 params, because wp_nav_menu_items takes 2 params ($items … Read more

add referrer to woo

The code in the original article is broken, and would’ve been broken when it was written. So being outdated is not the problem (2 years is nothing in WordPress time). The issue is this line: add_action(‘woocommerce_checkout_update_order_meta’, ‘add_referral_meta’); The callback function they’ve created, add_referral_meta(), accepts two arguments, $order_id and $posted: function add_referral_meta( $order_id, $posted ) { … Read more

Enable right click on WordPress site

This isn’t something WordPress is doing but probably your theme. Perhaps it’s an attempt to get people to not download your images or code, this is basically useless and doesn’t prevent anything like that. Your theme might be using something similar to this… document.addEventListener(‘contextmenu’, event => event.preventDefault()); Try searching your theme files for contextmenu and … Read more

Woocommerce image sizes missing from Appearance › Customize but not declared by theme

WooCommerce itself registers support for the default themes. For Twenty Fifteen it registers the following: add_theme_support( ‘wc-product-gallery-zoom’ ); add_theme_support( ‘wc-product-gallery-lightbox’ ); add_theme_support( ‘wc-product-gallery-slider’ ); add_theme_support( ‘woocommerce’, array( ‘thumbnail_image_width’ => 200, ‘single_image_width’ => 350, ) ); This is why those settings are not in the Customiser. However, regardless of what theme support is registered, the gallery_thumbnail_image_width … Read more

Strip div From Excerpt

If it’s just needed in one place, you could use the following: echo wp_strip_all_tags( get_the_excerpt() ); Keep in mind, using the custom excerpt field will automatically remove all tags. Creating an excerpt automatically from the post content will not. If you want more control, you can use wp_trim_excerpt() or wp_trim_words(). See: Using wp_trim_excerpt to get … Read more

Contact Form 7 If Condition

Yes, you should be able access the form fields and field values with event.detail.inputs in addEventListener on wpcf7mailsent. You can then use the field values in the conditional statements and add the redirects you need. There’s a simple code sample in the plugin doumentation, https://contactform7.com/dom-events/, for looping the fields. EDIT Here’s a code example, document.addEventListener( … Read more

Filter to wp_list_authors

wp_list_authors(), displays a list of the sites’s authors (users), and if the user has authored any posts, the author name is displayed as a link to their posts. Use $authors = get_users( [ ‘role__in’ => [ ‘auther’] ], // add other parameters ); Then loop through $authors to create your own list. foreach ( $authors … Read more