[theme-reviewers] Feedback on use of query_posts please -Badidea?

Zulfikar Nore zulfikarnore at live.com
Sat Sep 14 02:59:53 UTC 2013


OK, I have front-page.php in place + home.php
Conditions set as - Front Page to  static - front-page.php kicks in with custom (in my case featured content) + content of the page.Blog page has default template so home.php kicks in with blog feed and pagination in place.
Switch back to Front page shows latest post - front-page.php kicks in with my custom content and the blog feed.
My options in customizer to hide certain sections also work as I wanted :)
It does exactly what the man said it does - Chip thanks a bunch, problem solved - now for a bit of tweaking and upload.

Date: Fri, 13 Sep 2013 22:43:45 -0400
From: chip at chipbennett.net
To: theme-reviewers at lists.wordpress.org
Subject: Re: [theme-reviewers] Feedback on use of query_posts please	-Badidea?

Clearly, something is getting mis-communicated here.
User sets "front page displays" to "a static page". Then assigns pages to "front page" and "posts page". At this point, the blog posts index is now no longer displayed on the site front page, but is instead displayed on a static page.

At this point, the Template Hierarchy indicates that home.php (falling back to index.php) will be used to render the blog posts index. No custom page template will be used, even if assigned to the static page designated as the posts page.


On Fri, Sep 13, 2013 at 10:40 PM, Philip M. Hofer (Frumph) <philip at frumph.net> wrote:





Seriously?  
 
You do not get the concept of having a blog loop NOT on the home/landing 
page ?
 
 


 

From: Chip Bennett 
Sent: Friday, September 13, 2013 7:28 PM
To: Discussion list for WordPress 
theme reviewers. 
Subject: Re: [theme-reviewers] Feedback on use of query_posts please 
-Badidea?
 

There are many ways to implement a custom front page. The key 
points here are: 
 
1) Not to mis-use index.php as anything other than the default fallback 
template file
2) To incorporate/respect settings -> reading, front page displays/front 
page/posts page
3) To incorporate/follow the Template Hierarchy
 
A template-blog.php is almost always going to be _doing_it_wrong(), because 
when the user sets the front page to display a static page, and assigns a page 
to display the posts page, WordPress is never going to use template-blog.php to 
display that page. It's always and only ever going to use home.php, falling back 
to index.php.



On Fri, Sep 13, 2013 at 10:23 PM, Zulfikar Nore <zulfikarnore at live.com> wrote:


  
  I think I know where Chip is coming from. 
   
  front-page.php conditionally calls index.php when user has Settings 
  >> Reading set to latest posts and if they have the settings to static 
  page then front-page calls the whatever-you-want-on-front.php right?


  
  
  Date: Fri, 13 Sep 2013 22:14:31 -0400 
  
  
From: chip at chipbennett.net
To: theme-reviewers at lists.wordpress.org
Subject: Re: 
  [theme-reviewers] Feedback on use of query_posts please - Badidea?


  No, I think I have it exactly: 
   
  "But I've 
  had a lot of requests for options to hide certain sections and one of them 
  was the blog feed on front page."
  


  On Fri, Sep 13, 2013 at 10:12 PM, Philip M. Hofer (Frumph) <philip at frumph.net> wrote:

  
    
    
    
    Yeah, you’re not getting it.
     
    It’s not for the front page 
     
     
    
    
     
    
    From: Chip Bennett 
    Sent: Friday, September 13, 2013 7:11 PM
    
    To: Discussion 
    list for WordPress theme reviewers. 
    
    
    Subject: Re: [theme-reviewers] Feedback on use of query_posts 
    please - Badidea?
     
    
    
    
    index.php is NOT the front page template, and should not be 
    used as such. It is the default fallback template. 
     
    Use front-page.php for your front page template, and home.php for your 
    blog posts index template. Then all of your issues go away, magically. 
    :)
    


    On Fri, Sep 13, 2013 at 9:48 PM, Zulfikar Nore <zulfikarnore at live.com> wrote:

    
      
      I'm using the index.php showing featured content at the top 
      followed by the blog feed - which works fine and I had planned to stick 
      with that. But I've had a lot of requests for options to hide certain 
      sections and one of them was the blog feed on front page. 
       
      template.blog.php is to open the option to still have a page with the 
      blog feed on it when the user has opted to hide them on the front.
       
      Long story short - user hides posts on front but still wants a blog 
      fed page and this is my attempt to fill that need.


      
      
      Date: Fri, 13 Sep 2013 21:42:43 -0400
From: chip at chipbennett.net
To: theme-reviewers at lists.wordpress.org 
      
Subject: Re: [theme-reviewers] Feedback on use of query_posts 
      please - Bad idea?


      
      
      Why do you need template-blog.php when there is home.php for 
      exactly that purpose?
      


      On Fri, Sep 13, 2013 at 8:22 PM, Zulfikar Nore <zulfikarnore at live.com> wrote:

      
        
        I've read around that using query_posts is bad but I've 
        seen many a themes using it and get away with it. 
         
        My case is I'm trying to put together a template-blog.php for 
        StrapVert and this is what I've come up with so far:
         
        
        add_filter('option_show_on_front', '__return_false');
          global $wp_query;
            query_posts(array(
          'paged' => 
        $wp_query->get('paged'),
          'post__not_in' 
        => get_option('sticky_posts'),
            ));
         
          global $more; $more = 0;
            get_template_part('index-blog');
               $more = 1;
        remove_filter('option_show_on_front', '__return_false');
         
           wp_reset_query();
        wp_reset_postdata();
         
        But before I add these changes to the theme and submit an update 
        I'd like some feedback on "How Really Bad" is query_posts and can I "get 
        away" with the above?
         
        Thanks in advance,
        Zulf 
        
_______________________________________________
theme-reviewers 
        mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers



       
_______________________________________________ 
      theme-reviewers mailing list theme-reviewers at lists.wordpress.org http://lists.wordpress.org/mailman/listinfo/theme-reviewers

_______________________________________________
theme-reviewers 
      mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers



     

    

    _______________________________________________
theme-reviewers 
    mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers


     
_______________________________________________
theme-reviewers 
    mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers



   
_______________________________________________ 
  theme-reviewers mailing list theme-reviewers at lists.wordpress.org http://lists.wordpress.org/mailman/listinfo/theme-reviewers

_______________________________________________
theme-reviewers 
  mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers



 



_______________________________________________
theme-reviewers mailing 
list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers




_______________________________________________

theme-reviewers mailing list

theme-reviewers at lists.wordpress.org

http://lists.wordpress.org/mailman/listinfo/theme-reviewers





_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20130914/dd7bd11e/attachment.html>


More information about the theme-reviewers mailing list