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

Which action fire in front-end single post only

You can use the_content filter if you need to modify the content: add_filter( ‘the_content’, ‘cyb_content_filter_callback’ ); function cyb_content_filter_callback( $content ) { // Only for singular post views and for posts of main loop if( is_singular( ‘post’ ) && in_the_loop() ) { // modify $content here } return $content; } If you need an action that … Read more

custom single.php not working

Read Template Hierarchy article in the codex, especially pay attention to Single Post Display part. As you can see you have only three options: single-{post_type}.php single.php index.php It means that you can’t create a template for posts related to blog category. So you shouldn’t use single-blog.php template, use single.php instead and add there something like … Read more

Custom template for post type not working

get_post_format and get_post_type are completely different. Post Formats can be one of the following: ‘standard’ (default one) ‘aside’ ‘chat’ ‘gallery’ ‘link’ ‘image’ ‘quote’ ‘status’ ‘video’ ‘audio’ And shopping is the post type you have created and not post format. You can add post format for the post type(shopping) like this add_post_type_support( ‘shopping’, ‘post-formats’ );

get_terms parent for current product only

get_terms relates to getting all the terms of a taxonomy. get_the_terms grabs all the terms related to the post. The problem is that it sounds like you only want to return those terms which are parent categories, not the children, and get_the_terms does not pass an arguments array. $terms = get_the_terms( get_the_ID(), ‘product_cat’ ); foreach … Read more

Pagination for custom query on single.php

Well, for anyone else looking to solve a similar problem, I found this post, and it led me in the right direction: http://wordpress.org/support/topic/pagination-on-singlephp-causing-301-redirect?replies=9. I added this snippet of code to my functions.php, and I can paginate in custom queries without issue on single.php now. I don’t know enough about it to know what it does, … Read more