• Hi,
    On my site I have a slider with first 4 lastest posts – i’d like the slider to display only on first page
    after the slider i’d like to have posts number 5,6,7,8,9,10 – so my question is how

    on the second page, i’d like to have second 10 posts….and so on..

    currently i have slider on each page on index and 10posts after it. So i have slider with post number 1,2,3,4 and than again post 1,2,3,4 and the six other..

    can anyone help me please?

Viewing 15 replies - 1 through 15 (of 24 total)
  • This will require changes to your code. You might get some help if you put the code in a pastebin and post a link to it here.

    Thread Starter AndresHolmes

    (@andresholmes)

    ok, here’s my index.php
    i’m glad for any help

    Thread Starter AndresHolmes

    (@andresholmes)

    i tried something with query-post, but using offset always breaks my pagination…i know it’s a known issue of wordpress, so i tried to implement some solutions i googled, but i’m obviously doing something wrong, because i can’t dela with the broken pagination…

    can somebody please help me implement offset=5, showpost=6 for the first page for my theme?

    See if this will work. Change this:

    <div id="content-body">
    
    <?php do_shortcode('[upzslider]'); ?>
    
    <?php if (function_exists('wp_snap')) { echo wp_snap(); } ?>
    
    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    <?php query_posts($query_string . '&cat=-5'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    to this:

    <div id="content-body">
    
    <?php
    $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if ($page == 1) do_shortcode('[upzslider]');
    ?>
    
    <?php if (function_exists('wp_snap')) { echo wp_snap(); } ?>
    
    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    <?php query_posts($query_string . '&cat=-5'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post();
       if ($page == 1 && ++$post_count < 6) continue;
    ?>
    Thread Starter AndresHolmes

    (@andresholmes)

    thanks for your help!

    the first page seems allright now, but i’m getting the second page blank – no posts, only navigation buttons in the content

    Don’t know why that is happening. Take out this line and tell me the results:

    if ($page == 1 && ++$post_count < 6) continue;

    Thread Starter AndresHolmes

    (@andresholmes)

    10 posts on every site….
    so on the first page is slider(posts ##1234] and first 10 posts (##12345678910), second page is working…

    Thread Starter AndresHolmes

    (@andresholmes)

    Also tags were not working properly with that line. When I tried to display posts with tag, that was used in a post, that was not on the first page, I got an empty page.

    So the problem is with that line. The ‘$page == 1’ part seems to work, so maybe $post_count is a reserved variable. Try changing to this:

    if ($page == 1 && ++$my_post_count < 6) continue;

    Thread Starter AndresHolmes

    (@andresholmes)

    same problem…
    seems $post_count and $my_post_count are working too, they just work somehow for the whole index and not only for the first page of the index…

    For some reason, I can’t see your replies in the forum.

    When you take the line out, do you see the slider on only the first page?

    Thread Starter AndresHolmes

    (@andresholmes)

    yes, the slider is fine…

    Sorry, but I cannot see what is wrong.

    One last guess: change all $page to $my_page.

    I don’t think that is the problem, but it is worth a try.

    Thread Starter AndresHolmes

    (@andresholmes)

    Heh, it’s working now! Thanks very much!

    only the tags are still broken.

    when i try f.e. http://www.example.com/tag/video/
    and no post on the first page is tagged with video, i get a blank page – there’s not even the message like “sorry, but you’re searching something that is not here”, that i get if the tag was not used at all..

    can i make something like tag.php, like what you can do with categories?

    See if this will work:

    <?php
    $my_page = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if ($my_page == 1) do_shortcode('[upzslider]');
    ?>
    
    <?php if (function_exists('wp_snap')) { echo wp_snap(); } ?>
    
    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    <?php query_posts($query_string . '&cat=-5'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post();
       if (is_front_page() && $my_page == 1 && ++$my_post_count < 6) continue;
    ?>
Viewing 15 replies - 1 through 15 (of 24 total)

The topic ‘setting fifth post as first on index.php’ is closed to new replies.