WordPress Customizer: Check for value of CSS selector and replace it

You’re using a selector in this: if ( $( ‘#customizer-preview .site-title’ ).length > 0 ) { $( ‘#customizer-preview .site-title’ ).remove(); } It’s just like styling CSS property, if you were to add that rule to a style sheet, it would add styles for the element #customizer-preview .site-title So the code above is saying if an … Read more

How to add the option to choose between sizes for featured image within post editor?

<?php // First, enable thumbnails if they are not enabled yet add_theme_support( ‘post-thumbnails’ ); /* * Add image dimensions * * name * width * height * crop or resize (true or false) * * 99999 means very big number */ add_image_size( ‘featured-portrait’ , 200 , 99999, false ); add_image_size( ‘featured-landscape’ , 99999, 200 , … Read more

Embedded Options in a Custom Metabox

After a long investigation, it turned out that there isn’t any WordPress method that generates that information via methods/functions. That functionality should be built manually. For example, for the “publish post” metabox which contains the required functionality above, the code is listed here https://core.trac.wordpress.org/browser/tags/4.9/src/wp-admin/includes/meta-boxes.php#L22

How to add rewrite rule for product compare page?

Here you go: compare\/([^-vs-]*)(?:-vs-)([^-vs-]*)(?:-vs-)?([^-vs-]*)? Remember to escape backslashes (as I have done). I also made your lookups more consistent in their internal logic/structure. I assumed you wouldn’t want a second -vs- if the third product wasn’t there, so this is why you now have the second non-capturing group. Here is a link with the answer … Read more