Support » Fixing WordPress » More tag ignored on home page

  • Resolved heriz

    (@heriz)


    So my home page is set to display according to a template file as per Moshu’s superb Static Frontpage with Dynamic Content tutorial. It is set up to pull only the ‘news’ category posts, using a second loop. Here is the code for the second loop:

    <?php $temp_query = $wp_query; ?>
    <?php query_posts(‘category_name=news&showposts=8’); ?>
    <?php while (have_posts()) : ?> <?php the_post(); ?>
    <div class=”post” id=”post-<?php the_ID(); ?>”> <div class=”post-title”>
    <h3>” rel=”bookmark” title=”<?php the_title(); ?>”><?php the_title(); ?></h3>
    </div>

    <div class=”entry”>
    <p><?php the_content(‘(Read on) »’); ?></p>
    <span class=”post-date”><?php the_time(‘l F j, Y’); ?></span>
    <span class=”post-comments-home”><?php comments_popup_link(‘No comments yet’, ‘1 Comment »’, ‘% Comments »’); ?></span>

    etc…

    The only problem is that my ‘more’ tags are removed. As I really only want excerpts (but with the ‘read more’ option as opposed to the standard no-linked […] when using the_excerpt), this is frustrating.

    Adding

    <?php global $more;
    $more = 0; ?>

    Under the template name does nothing, and including it within the php template tags

    <?php
    /*Template Name: Main*/
    global $more;
    $more = 0;
    ?>

    breaks it completely. (Bear in mind I’m a novice in PHP, but this was suggested in a tutorial so it ought to work).

    Any suggestions on how to fix this please?

    Thanks…

Viewing 4 replies - 16 through 19 (of 19 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Your “Lorem Ipsum” post has a DIV in it which is messing up the remainder of the page.

    Remember, the “more” tag cuts off the post at that point. So if you start a DIV before the more and then end it after the more, your page gets hosed because the DIV remains unclosed on the main page.

    It’s best to simply not to use DIVs in posts.

    Otto, fantastic. That did the trick. I have no idea, how those <div> tags got in there in the first place. Can’t believe I missed that. Thanks a MILLION.

    anyone have trouble doing this with 2.7? i can get this to work at all in a template file.

    I already edited some stuff to change the read more text to Dutch for ‘Read the full article’, but it doesnt seem to display on the index page of my blog..

    I read the topic and the infopages on read more text editing here on wordpress, but I still didnt manage to change it properly.

    Problem is: on my index page I list my latest posts with a teaser which I cut off with the MORE TAG in the editor. But when I view the home page not after every teaser the more text is displayed.

    anyone please?

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘More tag ignored on home page’ is closed to new replies.