• Resolved pg73

    (@pg73)


    Hi

    Hope someone can help, been searching for ages for a solution but can’t find one.

    Can the ‘Reading Settings’ that control how the latest posts are displayed on the homepage (index.php) be used on another page? I’ve duplicated and renamed the index.php file and made a new page to use that template file, but it doesn’t show all the posts as the homepage does, it only attempts to show one, which is just the page’s title.

    So is there a way I can add a query string or something to the renamed index.php file to get it to use the same settings? I will need to customise this after as I want it to list the posts by number of comments rather than by most recent, but I think I’ll be able to do this once I can at least get it to show all the posts as on the homepage.

    Hope that lot made sense!

    Really appreciate any help you can give me.
    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is untested, but should be close:

    $posts_per_page = get_query_var('posts_per_page');
    $paged = intval(get_query_var('paged'));
    $paged = ($paged) ? $paged : 1;
    $args = array(
       'posts_per_page' => $posts_per_page,
       'paged' => $paged,
       'orderby' => 'comment_count',
       'order' => 'DESC',
    );
    query_posts($args);
    if (have_posts()) : while (have_posts()) : the_post() {
       // Rest of Loop
    }
    endwhile; endif;
    Thread Starter pg73

    (@pg73)

    That worked a treat, a big thank you – I really appreciate the help, it was really stressing me out! One last thing (if you don’t mind), I was searching and trying for ages to achieve something, that with your help, has been achieved another way. But out of interest, if you could have a quick look at this earlier post I made and let me know if it’s possible, thank you.

    No link to other post! ;(

    Please mark this topic ‘Resolved’. Thanks.

    Thread Starter pg73

    (@pg73)

    I took a look at your other post, and that question is beyond my expertise. I did not respond to that post because persons looking at the forum generally look for unanswered posts to see what needs to be addressed.

    Thread Starter pg73

    (@pg73)

    No problem, thanks for your time and help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Use Loop from Homepage on another Page’ is closed to new replies.