Disable single view for specific post category

You can disallow a category to be listed by search engines using an SEO plugin such as Rank Math. http://rankmath.com/ De-indexing a category can be easily done. However for not letting your users click on the posts that can be a little more tricky if they are already on the category page. One possibility is … Read more

Help with figuring out the future post workaround

I think the answer is: when you’r in single page/post/cpt view ( you’r checking it with is_single() ) you always should have $wp_query->post_count equal 1, but if it is future post/page/cpt than it will result to 0 ( becouse there are function/actions applyed to check if it is future post ) and $posts = $wpdb->get_results($wp_query->request); … Read more

Add inline style to get_the_category_list

get_the_category_list() does not really have any filters to achieve what you want. You will currently need PHP like preg_replace() to alter the anchor tags. The big issue would be to get the current link’s term object, which in my opinion would turn it into a quite messy procedure. You could however write your own function … Read more

How do I show google ads between post content?

You can use a shortcode or the_content filter. I think the_content filter is better because your don’t introduce any string in your post, so the content can be exported and used in another platforms if needed. For emxample, for show a block of adsense after the first parragraph: add_filter( ‘the_content’, ‘tbn_ads_inside_content’ ); function tbn_ads_inside_content( $content … Read more

Single post comment template not working

Here’s 2 solutions i tested: Try adding support for comments in your custom post type code ‘supports’ => array( ‘comments’ ), You could also use add_post_type_support add_action(‘init’, ‘wpsites_comments’); function wpsites_comments() { add_post_type_support( ‘events’, ‘comments’ ); } Code Source

Listing a post’s categories and subcategories

Update 1: Thanks to @birgire for suggesting a better way: wp_list_categories( [ ‘include’ => wp_list_pluck( get_the_category(), ‘term_id’ ) ] ); Try this in your single.php template: $current_cats = get_the_category(); $current_cats_ids = []; foreach ($current_cats as $cat) { $current_cats_ids[] = $cat->term_id; } wp_list_categories([ ‘include’ => $current_cats_ids, ]);

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