WordPress.org

Ready to get started?Download WordPress

Forums

Custom Page Template (12 posts)

  1. RobbieB1953
    Member
    Posted 6 months ago #

    To create a custom page template to exclude sticky posts from one category, codex provides the following:

    $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    $sticky = get_option( 'sticky_posts' );
    $args = array(
    	'cat' => 3,
    	'ignore_sticky_posts' => 1,
    	'post__not_in' => $sticky,
    	'paged' => $paged
    );
    $query = new WP_Query( $args );

    At what line do I insert this in my page template?

    Thanks!

  2. Pioneer Valley Web Design
    Member
    Posted 6 months ago #

    Can you link us to this codex article please? I cannot at this moment check each.

  3. RobbieB1953
    Member
    Posted 6 months ago #

    http://codex.wordpress.org/Sticky_Posts

    It's the 3rd code block in "Don't Show Sticky Posts"

  4. Pioneer Valley Web Design
    Member
    Posted 6 months ago #

    You need to use this is in the theme's category page template/archive page template/loop page template/index page template - depends on theme. What theme are you using?

  5. RobbieB1953
    Member
    Posted 6 months ago #

    twentyfourteen

  6. Pioneer Valley Web Design
    Member
    Posted 6 months ago #

    Great...thanks for the added information that is always useful. Now which site would this be occurring at?

  7. RobbieB1953
    Member
    Posted 6 months ago #

  8. Pioneer Valley Web Design
    Member
    Posted 6 months ago #

    And now I have to do the work of finding out what the site really is? Per forum rules, for help with your site, post the site url.

  9. RobbieB1953
    Member
    Posted 6 months ago #

    Sorry, don't you just click on it? http://robbieburnsreturns.com

  10. adonismoet1
    Member
    Posted 6 months ago #

    Hey sorry to interrupt but pioneer can you lend assistance @ http://wordpress.org/support/topic/commenting-problems?replies=4

    Thanks

  11. Pioneer Valley Web Design
    Member
    Posted 6 months ago #

    @adonismoet1

    It is considered 'rude' to interrupt another's support request. Each post will be reviewed, in it's own time. All who help here are volunteers committed to the Open Source community WordPress is so well known for. If you require help immediately, this forum is not your best option. Please review this per forum rules.

    @Robbie, I loathe bit.ly links (review why online). It is each forum users own decision whether to follow a link or not. I strongly encourage all forum members to use an online scanner (Such as Sucuri, but read the footnotes) to review each link posted here first. Even then, to ensure in the event such site is hosting code that can break your local machine, that you have done your best to get yourself up and running securely again after visiting such sites.

  12. RobbieB1953
    Member
    Posted 6 months ago #

    Understood, PVWD. I appreciate your efforts.

    You need to use this is in the theme's category page template/archive page template/loop page template/index page template

    Would you please elaborate?

    Thanks!

Reply

You must log in to post.

About this Topic