Filter for the Custom Post List Page

The restrict_manage_posts hook supplies the current post type as the very first parameter to the callback function (which is book_genre_filter_page() in your code), so you should use it (instead of the static $type variable in your code) to determine the current post type or to ensure your custom filter is displayed only on the admin … Read more

Echo text using is_tag

That’s not what is_tag does: Determines whether the query is for an existing tag archive page. https://developer.wordpress.org/reference/functions/is_tag/ is_tag and other functions such as is_search etc don’t tell you anything about a post, they tell you if you’re on a search archive, or a tag archive, etc So is_tag is true on example.com/tag/example but would be … Read more

How should I be using filters and is_single together?

You can do this in functions.php, but you have to make sure the function is hooked into wp. Any earlier than that and is_single is undefined. Try adding this to functions.php: /** * Unhooks sixtenpresssermons_get_meta from the_content if currently on single post. */ function sx_unhook_sixtenpresssermons_get_meta() { // Do nothing if this isn’t single post if … Read more

How to change WooCommerce loop product title HTML output in single product page and archive page

The main problems with what you’ve got are tha your close bracket } for the is_product() case is in the wrong place: it should be before the elseif not at the bottom of the block. (This is what Tom meant by indenting your code correctly: if you’d indented each {…}, which your IDE will do … Read more

How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)

Try using is_post_type_archive() and is_singular(): // … if ( is_post_type_archive( ‘my-post-type’ ) || is_singular( ‘my-post-type’ ) ) { // your enqueue code goes here } // … These functions will check to see if you’re on, respectively, an archive page for the post type my-post-type or a single my-post-type post. (Change the my-post-type to what … Read more

Should $query-> be used with conditional tags?

As background, there are functions in WordPress that tell you certain things about the main query. For example, is_search(), is_archive() etc. will tell you whether the main query is a search query, or an archive query respectively. These typically, but not necessarily, line up with where certain templates will be used. You use these functions … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)