WordPress.org

Support

Support » Themes and Templates » <!–more–> working in archive.php but not in index.php

<!–more–> working in archive.php but not in index.php

  • My index.php and archive.php are almost identical. In the crucial place within the loop both contain:

    the_content('Read the rest of this entry &raquo;')

    In pages that use archive.php posts which contain <!--more--> do what is expected — the text up to the more tag is include followed by a link that says “Read the rest of this entry »;”.

    Now I have a custom home page set by creating a home.php file. For the blog I have created a page called News which uses a custom template called news.php which contains just this:

    <?php
    /*
    Template Name: News
    */
    ?>
    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("paged=$paged&cat=-0"); //gets all posts
    load_template( TEMPLATEPATH . '/index.php'); //loads index
    ?>

    Everything about this seems to work except that the more tag no longer does anything, instead the whole of posts containing a more tag is printed the News page.

    Does anyone have an idea why this should be so?

    Thanks in advance.

    Best, Darren

Viewing 2 replies - 1 through 2 (of 2 total)
  • Because it is a Page Template and WP recognizes it as such. And on Pages the more thing does NOT work: normally on a Page you see the whole content because Pages’ content is never “listed” on one file as in the case of posts on index or archives.

    Ah, thank you moshu. That’s a tad disappointing (for me) but makes perfect sense. It isn’t really a big deal and I can live with it as it is, however, if someone has an idea for a workaround which wouldn’t be too time consuming then I’d be interested in hearing it.

    Thanks for the help as always.

    Best, Darren

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘<!–more–> working in archive.php but not in index.php’ is closed to new replies.