• Hello,

    Im making a very visual theme. Its basically a thumbnail theme with infinite scroll.
    My index page its almost complete and ok, Im doing now the single.php page and I have a problem, hope it can be solved, I suppose so.

    I just want to load all the posts inside the single.php
    This page basically shows the image posted in bigger size and at the bottom I would like to add the next posts. (in case this post is from 5 january for example, it would show all post next to this date)

    I’ve added this code to the single.php after the load of the image to try to load all posts:

    <?php get_template_part( ‘loop’ ); ?>

    the loop is a php that calls the posts its the same used at index.php

    The only problem is that this call, just puts the post of the single page that Im in.
    So if the ID is 5, it posts the bigger image and below only the respective thumbnail post and not all the post next…

    can anyone help me with this?
    thanks in advance!

Viewing 10 replies - 1 through 10 (of 10 total)
  • You need to use multiple loops.

    Thread Starter antropomorfic

    (@antropomorfic)

    Hey,
    thank you for you’re answer.
    I used the multiple loops now, and yes it loads the posts but I still have problems.

    it repeats the loops twice, and cant find why…you can see it here:
    https://tinyurl.com/64sj66r

    and any idea on how can I query to only call the posts with the date (time) after the post you’re actually in!?

    something like this:

    if this post was done day 14th January at 17.00h show all post after 14th january at 17.00h not including the actual.

    the code is like this right now:

    <?php query_posts(”); ?>

    <div id=”sort”>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”box”>
    <?php the_content(”); ?>
    <div class=”aDate”><?php the_time(get_option(‘date_format’)); ?></div>
    </div>
    <?php endwhile; endif; ?>
    </div>

    thanks!!!

    Thread Starter antropomorfic

    (@antropomorfic)

    just noticed that if I use the code I said before it doesn’t load all the posts,
    any idea why? =/

    thanks

    Thread Starter antropomorfic

    (@antropomorfic)

    Thank you for the answer again ;D

    yes now it show the posts, the only problem is that the infinite scroll is not working anymore because the navigation to present posts wont work and I think its because of wp_query (‘showposts=20’)

    the code is like this now:

    ‘<div id=”sort”>
    <?php $my_query = new WP_Query(‘showposts=20’);
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <div class=”box”><?php the_content(”); ?>
    <div class=”aDate”><?php the_time(get_option(‘date_format’)); ?></div>
    </div>
    <?php endwhile; ?>
    </div>’

    thanks again!!

    Thread Starter antropomorfic

    (@antropomorfic)

    and why is the post duplicated if the code says:

    $do_not_duplicate = $post->ID; ?>

    ??

    =/

    Hi @antropomorfic .

    I would ask how did you write the single or index php for show only one post per page but still show all other posts ( thumbnails? )?

    but i would show on the div – box also posts and when the visitor clicks on more pictures, or read more it loading the content to the area between the header image and the boxes

    like this https://nivovas.co.uk/test/dave/index2-content-box1.html

    click under the picture the “more pictures,,,” or “read more..” links.

    this is plain html cos i couldnt build that theme in wp.

    ??

    thank you for any help?

    Jean

    Thread Starter antropomorfic

    (@antropomorfic)

    Hi @nivovas ;D

    on my page the index shows all posts, the single shows the post and the posts after the date youre in. (Im still on it) Can’t query the condition to get all the posts with the post_date bigger or equal to the post Im in! something like that…

    So the single calls the content of the post to one div and the rest of the posts to another div basically (for this one the code is above)!

    for what I saw on your page if you just want to show a bigger image on that div at top you can use javascript, dont know the code for it right now but you can find it easily…
    and if you want to show the content of the post in your main page, I dont have a clue! =/

    Thread Starter antropomorfic

    (@antropomorfic)

    Can anyone help me with this??=/

    Im trying on the single.php to show the content of the post and to load all posts next to date of the post that Im in!

    I think that I have to query all posts to search for those that the date is equal or next to the date of the post that Im in. =/ can anyone help??

    now my code is like this:

    <?php query_posts(‘order=post_date&order=asc’) ?> //the condition that I have to change! =/
    <?php
    <div id=”sort”>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class=”box”>
    <?php the_content(”); ?>
    <div class=”aDate”><?php the_time(get_option(‘date_format’)); ?></div>
    </div>
    <?php endwhile; endif; ?>
    </div>

    thanks

    @antropmorfic is this what you are looking to do if you change the location of your edit post link it might help?

    <div id="sort">
    <?php $my_query = new WP_Query('showposts=20');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    <div class="box"><?php the_content(''); ?>
    <div class="aDate"><?php the_time(get_option('date_format')); ?></div>
    <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
    </div>
    <?php endwhile; ?>
    </div>
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to load all posts in the single.php’ is closed to new replies.