adding an action inside if condition not working
adding an action inside if condition not working
adding an action inside if condition not working
Classic case of = instead of ==, ie. you’re assigning values in a conditional statement, which always resolves to true: if ( $need == “Option A”) { get_template_part(‘front/option-a’); }
Please try like if ( is_front_page() || is_home() ) { //IF HOME PAGE } if ( is_singular(‘YOUR-CUSTOM-POST-TYPE-HERE’) ) { // FOR SINGLE PAGE STUFF } Please make sure you have to replace YOUR-CUSTOM-POST-TYPE-HERE with your Custom post type. Please let me know if any query. Thanks!
I’am wondering how to target a search result page within the functions.php file in wordpress. Use is_search, and the search.php template I know about “is_search” for the search page but what about the search result page ? They are the same thing, is_search indicates the main query is a search query. When is_search is true, … Read more
How to get Post sidebar & footer including html like get_the_content() which only gets content section?
Try has_category, instead; is_category is used for archive pages, not single posts.
It is some syntax errors. on line 2 to 4 you’re missing ending semicolons. And endif line is not needed for curly-braces if statement.
Add an identifier to a set of pages to access using a conditional tag
You can use this filter so when user comes into your website so you will redirect to them on specific page and display that specific page. function user_redirect_page() { return site_url().’your-page-slug’; } add_filter(‘login_redirect’, ‘user_redirect_page’);
Looking to the problem from a different perspective, I’ve reached to a different solution to it. I’ve created a function to check the post type instead of checking the slug of the post type. Actually I was trying to assign different CSS Class to each post type add_action( ‘css_class_per_post_type’, ‘assign_css_class_to_each_post_type’ ); // to be called … Read more