• Resolved yokima

    (@yokima)


    Hello,
    I want a WordPress page (permalink) http://krcla.org/blog/immigrant

    to display its own query_posts and display posts respecting the <!–more–> tag. According to Codex at http://codex.wordpress.org/Template_Tags/the_content,

    If the quicktag <!–more–> is used in a post to designate the “cut-off” point for the post to be excerpted, the_content() tag will only show the excerpt up to the <!–more–> quicktag point on non-single/non-permalink post pages.

    I want to revert this and make the_content use the cut-off point for single and permalink post pages. So far my code looks like this:

    <div class=”english-column”>
    <?php rewind_posts(); ?>
    <?php query_posts(‘cat=21,-2&showposts=10’); ?>
    <?php the_content(‘<p class=”serif”>Read the rest of this page »</p>’); ?>

    And the full content showed up. I tried using the_excerpt reloaded but it doesn’t work (see the link I provided at the beginning)

    How would this be possible?

Viewing 15 replies - 1 through 15 (of 17 total)
  • Doodlebee

    (@doodlebee)

    I want to revert this and make the_content use the cut-off point for single and permalink post pages.

    Why would you want to do that? And if you did that, what would you link to when people click on “read more”? That’s the whole point of the single/archived/permalink pages – it shows the whole post. Anywhere in the blog that has a post written will *always* link to the single/archive/permalink page. If you cut off the basic format of the page, what else would there be to link to? The would be like…well “eating your cake and having it too”. Ain’t gonna happen.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Yeah, that doesn’t make any sense. The purpose of the more tag is to stop showing the content on the main page and show a link to take you to the single post page instead.

    If you’re looking to paginate your single posts, like make multi-page posts, then you should use the <!–nextpage–> tag instead.

    Chris_K

    (@handysolo)

    Or… go back to using the_excerpt on the index.php. On the Write Posts page, use the excerpt field (scroll down a bit to see it under the post field) for what you want on the front page, and the Post field for what you want in the single view.

    Thread Starter yokima

    (@yokima)

    Thank you for the feedback; I don’t want to use the excerpt for the “page content” in the page display.

    I want the page display in full of course, but I want the page to act as a “topic portal”, with the page content on top and an list of excerpts of the most recent X posts under a certain category (to be specified at the template level) under it.

    The reason I’d rather not use a category page for this purpose is because it’s harder to edit the static descriptive section of a category (you would need to edit the Template itself) – I want other entry level administrators of the blog to be able to edit the “portal description” in page edit mode.

    Is this possible?

    Thread Starter yokima

    (@yokima)

    <bump>

    You’ll need to make your own template for that, then edit the page(s) that need to work that way and select your template (on the right). It’s not that hard to do :).
    http://codex.wordpress.org/Stepping_Into_Template_Tags

    rudolf45

    (@rudolf45)

    If you insist on using a Page template – it will not be easy. The “more” tag doesn’t work on Pages – by default.

    If the only reason is to make the “descriptive section” editable from the admin panel… I’d, probably, go by using the get_a_post plugin, and then create 3 Pages that are excluded from showing up anywhere. With the plugin you can ’embed’ the_content of those Pages in the category template files as a “description” and still being able to edit the text anytime from the admin.

    carlosbronze

    (@carlosbronze)

    If you insist on using a Page template – it will not be easy. The “more” tag doesn’t work on Pages – by default.

    damn…

    I am trying to get a page to display the posts on a specific category, with the ‘more’ link to their single pages.
    Does this mean that cant be done?
    I am currently using the_excerpt on the template for that (new template i created and chose for the page) as a workaround…

    I’m in the same predicament as carlosbronze. I basically just added a query posts call before the main loop on the index page and used that as a template for other pages. Doing this I now have 3 separate pages that each display a different category.

    My only problem is now when users go to a certain category page they see the entire text of the posts instead of the section before the more tag. Anyway to get the page to recognize it?

    Doing this I now have 3 separate pages that each display a different category.

    That always seems a nonsense to me when WP does it already automatically with the Category_Templates.
    Any logical reason not to use it?

    I don’t understand why everyone thinks this is nonsense. What if you have a home page with an article that you want to feature, and then have other posts flow below it. If you write your own query string, WordPress ignores the <!–more–> quicktag. It’s a bug. Plain and simple and needs to be fixed.

    Moshu, he already explained that he would like his authors to be able to change the leader for each page before the posts are listed. The reason not to use the cat template is that any leader text would need to be embedded into the template and displayed using php conditionals – hardly user-friendly for his authors, and not particularly conducive to content/markup separation.

    Ruzel, If this was ever a bug, it isn’t anymore, I’m doing this right now with 2.3.

    Ivovic,

    Can you explain how you are doing this. I am trying to make a custom 2 column template page that will break a page up using the <!–more–> tag. Something like this…

    <div style="width:300px;float:left;">
       <?php the_content("",false); ?>
     </div>
     <div style="width:300px;float:left;">
       <?php the_content("",true);?>
     </div>

    The problem of course is that the first column has the whole post in it. The second column shows everything after the <!–more–> tag, which is what I want.

    Anyone know a good way to do this? (ie pull everything before the <!–more–> even on a page)

    Thanks

    Update…

    It is possible to force a pages with a single post to support a <!–more–> tag…

    <?php global $more; $more = false; ?>
    <?php the_content('Continue Reading'); ?>
    <?php $more = true; ?>

    see Here

    ruzel

    (@ruzel)

    Ivovic,

    I should point out that when I say this is a bug, it’s a little more subtle than what I first wrote. The “bug” is that if you write your own query string to fetch posts with, you will get all the post content before the <!–more–> but stripped of its formatting. Overwriting the author’s intended formatting is the bug. The same thing happens when you call the_excerpt and *in addition* your post is now cut-off at a default length and not where an author intended. The end consequence of this is that outside of the loop, there is no way to call a post’s pre-more content with formatting intact. Surely, that’s not what WordPress’s default behavior should be.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘How to make the_content respect <!more> tag in’ is closed to new replies.