Viewing 7 replies - 1 through 7 (of 7 total)
  • wrap the ‘featured post’ code in a conditional tag

    https://codex.www.ads-software.com/Conditional_Tags#A_Paged_Page

    <?php if(!is_paged()) :
    /* put all the code of the featured post here */
    endif; ?>

    in english: if it is not a paged page (i.e. not the previous posts page) then show ‘featured post’

    Thread Starter amfarr

    (@amfarr)

    Thanks alchymyth! That fixed that problem, however, my other problem still seems to persist.

    It shows the right amount of posts on each page but if you click on previous posts there is one space that isn’t filled, is there a way to tell the front page to show 3 posts and the rest to show 4?

    is there a way to tell the front page to show 3 posts and the rest to show 4?

    hard to tell without knowing your theme files.

    if you could post the code of the file that generates the front page (index.php ?) into a pastebin and post the link to it here, someone might have a look at it and might have some ideas.

    Thread Starter amfarr

    (@amfarr)

    Ok here is my index.php https://pastebin.com/J9pU7dcd

    i can’t see a simple way to do this.
    i thought that setting a query with 3 posts_per_page on the first page would do, but then the second page begins with post 5 instead of post 4 – so that did not work.

    a complicated way could be to write a custom ‘pagination’ by calculating the offset for each paginated page and using query_posts() with the offset parameter before the loop.

    Thread Starter amfarr

    (@amfarr)

    That sounds way to complicated for me. Is there a way to point the previous posts to a different layout so that they aren’t in boxes like that, say the archives.php or something else? Would that be easier?

    Thread Starter amfarr

    (@amfarr)

    I fixed it! I just removed this and now it shows the right amount of posts on each page.

    <?php if( $post->ID == $feature_post_id ) continue; ?>

    I toyed around with the “paged” property but I didn’t get the wanted results. The “featured” tagged posts will still be included but it’s the simplest solution.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to I get Featured Post to not show on previous post pages?’ is closed to new replies.