How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
How To Conditionally Include A Short Code Depending On The HTTP_REFERER [closed]
Conditional Tags Based on Previously Viewed Posts
Conditional query that displays on Woo product attribute pages
Ended up with this as the function: // set up the settings for the theme.js function mb_scripts_settings() { // blanks $mb_ajax_form_type = $mb_get_page_slug = $mb_redirect = $mb_redirect_time = $mb_form_disable = $mb_array = ”; // get the form type $mb_ajax_form_type = ( is_front_page() ? ‘change’ : ‘submit’ ); // get the page slug from ID $mb_get_page_slug … Read more
is_author() isn’t working as you expect because it checks whether the current query is for an existing author archive page. If you’re placing your code in single.php inside the loop, you can use this instead: <?php if( $post->post_author == ’15’ || $post->post_author == ’16’ ) { ?> <div>Your code here</div> <?php } ?>
Recently I had to tackle the same issue. Instead of setting the capability permanently for editors, I used user_has_cap filter to allow access dynamically. add_filter(‘user_has_cap’, ‘editor_allow_edit_menu’, 10, 4); function editor_allow_edit_menu($allcaps, $caps, $args, $user) { if ( ! isset( $allcaps[‘editor’] ) || true !== $allcaps[‘editor’] ) { return $allcaps; } global $pagenow; // new items are … Read more
A simple method for disabling WPML language switcher when meeting specific circumstances [closed]
This is just sort of a PHP shortcut, but you could create a mapping describing which conditional values map to what menu locations, and loop through it testing each condition and printing menus for matches: /** * Prints wp_nav_menu(s) by matching conditional function arguments to menu locations. * * @param array $locations A mapping of … Read more
How add various functions within 1 conditional?
There are several ways to do this, one method is to use get_the_terms. The logic would be to run the loop and customize the output based on the terms for that taxonomy ( this will probably not work out of the box). //do a custom query here if needed if ( have_posts() ) : while … Read more