Multiple navigation menu in same location

Create multiple menus for each parent page and use an if condition to test which is the parent page and output that particular menu. You could keep the menu names the same as the parent page names so that any future pages created with new menus will still work. empty( $post->post_parent ) ? $post_parent_name = … Read more

How add body_class from wp_termmeta

First check it is product category archive page using is_tax Then use get queried object_id to get the current term ID Then after you can use get_term_meta to get class name. Example: add_filter( ‘body_class’, ‘lalka_custom_taxonomy_in_body_class’ ); function lalka_custom_taxonomy_in_body_class( $classes ){ if (is_tax(‘product_cat’)) { $custom_class = !empty( get_queried_object_id() ) ? get_term_meta(get_queried_object_id(), ‘custom-class’, true) : FALSE; if … Read more

Image Crop Not Working

I figured it out. I had to pass the image in as an ID rather than a URL. <?php $image_id = get_field(‘content_image_1’); $image_size=”home-left-column-block”; $image_array = wp_get_attachment_image_src($image_id, $image_size); $image_url = $image_array[0]; ?> <img src=”https://wordpress.stackexchange.com/questions/220603/<?php echo $image_url; ?>” alt=”<?php echo the_field(‘content_block_title_1’); ?>” height=”420″ width=”630″>

Code to insert code into single php

Confusing question. It sounds like you mean the plugin is checking for <!– code –> in the raw post content and using this as a trigger to indicate not to add the ad code. I think you need to identify the filter that the plugin is using to add the ad code so you can … Read more

How to overwrite template.php file

Got it. In your parent template.php. Some function were not wrapped in: if( !function_exists(‘function_name’) ) { // function content } So you won’t able to override that function. Make sure to wrap parent function that tend to be override in child by above code. FYI, for function, you don’t need to create a file with … Read more

Suggest Users basing on User taxonomy

You cannot query users by taxonomy. You will need to rethink your system. What would I do? Keep the taxonomies but use these only to output choosable values – wp_dropdown_categories() Save the selected value AS user meta, NOT AS taxonomies – update_user_meta() Now you can query users by that value – WP_User_Query() Example: This code … Read more

How can I change the size of the text in Word Press

First of all, remember that html is for adding meaning and css appearance. If you want to change the text size for sematic reasons, like “this text is a subsection title” or “this sentence is very important”, I would advice you not to use <span style=”font-size: xx”>. It’s a better practice for those cases to … Read more