How te exclude first 5 news items from Genesis loop on blog page

Community Forums Forums General Discussion How te exclude first 5 news items from Genesis loop on blog page

This topic is: resolved

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  jaapstronks 7 months, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #100139

    jaapstronks
    Member
    Post count: 1

    Hi, I have made a custom blog page template where I use a widget area in the top half of my blog page to display the titles & excerpts of the most recent 5 blog posts using widgets (I did this to have more control on design and formatting). The blog page can be found here, btw. Below this widget area, the blog page starts showing the loop as default.

    In order to avoid displaying duplicate blog post excerpts, I would like to modify my blog page template (or functions.php, whatever would be the best option) to exclude the first 5 items (but only on the first page, obviously, as the aforementioned widget area is only displayed on the first page as well, not on /page/2/, /page/3/ and so on).

    I suspect this would be pretty easy, using a filter or a custom loop function or something, but I haven’t been able to figure out how to pull this off exactly. If anyone could help me out with this, that’d be great!

    http://techniekpact.nl/nieuws/
    #100153

    Sridhar Katakam
    Participant
    Post count: 1068

    Try this:

    1) Rename page_blog.php to home.php.

    2) Go to Settings > Reading and set ‘Nieuws’ as the Posts page. You might want to set a static Page as front page.

    Reference: http://www.billerickson.net/dont-use-genesis-blog-template/

    3) Add the two blocks of code on this page in functions.php.

    Set the value of $offset to 5 in each of the code blocks.


    #100682

    jaapstronks
    Member
    Post count: 1

    Wow. Thanks! That did the trick. For anyone reading this later on, who would like to pull off something similar: I followed Sridhar’s advice. I renamed home.php into homepage.php and added a bit of code to make it into a template. I created a new empty page called ‘homepage’ and selected the homepage template as its template. I renamed page_blog.php into home.php. In functions.php, I had asigned a couple of widget areas to the blog page; I had to alter the ‘if’-statement that selected the page ID of the blog page to an is_home statement which targets the first page of news articles. Well, that. Thank you again, Sridhar!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘How te exclude first 5 news items from Genesis loop on blog page’ is closed to new replies.