WordPress.org

Ready to get started?Download WordPress

Forums

content (20 posts)

  1. davy_yg
    Member
    Posted 2 years ago #

    <p><?php the_content(''); ?>... read more ></p>

    Can anyone help me fix that code. I would like to trim the content to certain amount of words. Then, whenever someone click the readmore, it will brings me to another page which shows the whole content.

    any advise ?

    it's for this page

    I am using post to post the content, I do not know what I would name the page that shows the whole content.

  2. davy_yg
    Member
    Posted 2 years ago #

    Additional information:

    <p><?php the_content(''); ?>... <a href="lorem-ipsum-8/">read more ></a></p>

    Is there any way to place the post page-name or title in the href ? page-name is better I think, so whenever people click the a href it will expand the post content.

  3. Gary Darling
    Member
    Posted 2 years ago #

    This tells you everything you need to know about read more.

  4. davy_yg
    Member
    Posted 2 years ago #

    I've tried adding this: <?php the_content('Read more...'); ?>

    and it still does not show me the read more. and also where to place the link name ?

    Thanks.

  5. Gary Darling
    Member
    Posted 2 years ago #

    Just to make sure we are on the same page, are you expecting the 'read more' to show on the single post page? Because it won't - it only shows on pages that show multiple posts, like a listing of all your latest posts, or a category page.

    When you create a post you can insert a <--more--> link so that when that post shows on a category or archive page, you only see the text above the more link. But when you visit the post itself you see all of the text, unless you are using a pagination plugin.

  6. davy_yg
    Member
    Posted 2 years ago #

    Yea, it's for this page: Page News

    Is this the correct syntax to show the read more next to content ? <?php the_content('Read more...'); ?>

    First, I still do not see the read more. Second, where to place the link address ?

  7. Gary Darling
    Member
    Posted 2 years ago #

    Are you using the code inside The Loop? It will only work there, reason I ask is that your content appears to be static, as though you hand-crafted the page rather than let WordPress show the posts thru a standard loop query. You have to use The Loop.

    Once you have it inside the loop, the_content gets the id of the post and converts it to a hyperlink, then shows the default 'more' text unless you override it inside the parens. So,

    <?php the_content(); ?> results in (more...)
    <?php the_content("Read more"); ?> results in Read more
    <?php the_content("Continue reading " . the_title('', '', false)); ?> results in "Continue reading ACTUAL POST TITLE"

  8. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Are you adding a <!--more--> link somewhere within your Post Content?

  9. davy_yg
    Member
    Posted 2 years ago #

    Yes, I do have loop:
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <p><?php the_content("Read more..."); </p>
    <?php endwhile; ?>

    The read more does not display correctly.

    About - News

  10. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Are you adding a <!--more--> link somewhere within your Post Content?

  11. davy_yg
    Member
    Posted 2 years ago #

    Hmm.. nope. I do not see any of that sign. What is it for by the way ?

  12. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Hmm.. nope. I do not see any of that sign. What is it for by the way ?

    That is the comment that you have to add to your Post Content, in order to invoke the "read more" link.

  13. davy_yg
    Member
    Posted 2 years ago #

    ok, I'll try this:

    <!--more-->
    <p><?php the_content("Read more..."); ?></p>

    and it still does not show me the read more.

  14. Ming Sheu
    Member
    Posted 2 years ago #

    <!--more--> needs to go into the actual post content when you write the blog post.

    It does not go in the php template file.

  15. Gary Darling
    Member
    Posted 2 years ago #

    In your html Post editor there is a more button, click that when the cursor is where you want the link.

  16. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    ok, I'll try this:

    <!--more-->
    <p><?php the_content("Read more..."); ?></p>

    and it still does not show me the read more.

    That's your template file. You need to put the <!--more--> tag in your actual Post Content.

    For example:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce auctor sollicitudin lacus vel condimentum. Vivamus vitae lectus venenatis sapien auctor commodo. Fusce vel purus tellus. Donec porta porta eros quis aliquet. Sed a sagittis odio. Proin fringilla gravida urna, et rutrum dolor blandit euismod. Donec tincidunt justo sed est consectetur hendrerit. Proin ut imperdiet velit. Cras mollis nunc et nulla imperdiet nec mollis urna lobortis.

    <!--more-->

    Nullam ut lacus vitae arcu condimentum sollicitudin ac ac eros. Quisque accumsan auctor erat, eget venenatis nisl lacinia id. Suspendisse eget magna turpis. Aenean rhoncus, mauris nec ullamcorper bibendum, ligula diam blandit diam, vel rhoncus purus sapien non mi. Aenean a convallis arcu. Phasellus non est mollis eros lobortis vestibulum consequat ac arcu. Fusce justo urna, ultrices ut varius a, eleifend ac justo. Sed ornare rhoncus turpis sed accumsan. Curabitur dignissim, justo id facilisis elementum, mauris orci convallis augue, non scelerisque lacus dolor et lorem. In hac habitasse platea dictumst. Phasellus laoreet imperdiet odio, ac tristique sem dictum et. Proin mattis, eros in dignissim dignissim, nibh tortor congue nibh, at lacinia erat elit vitae diam.

  17. davy_yg
    Member
    Posted 2 years ago #

    page-news.php

    <p><?php the_content("Read more..."); ?></p>

    POST CONTENT

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce porta diam in quam consectetur elementum. Vestibulum iaculis pellentesque mauris, non sodales erat egestas nec. Proin sed elit sed ligula ullamcorper adipiscing. Quisque pellentesque sapien odio. Phasellus nec elit ligula. Ut tempus urna ut lectus ullamcorper imperdiet.

    <!--more-->

    Quisque vitae massa sem, sed cursus sapien. Ut mi lorem venenatis nisl lacinia id. Suspendisse eget magna turpis. Aenean rhoncus, mauris nec ullamcorper bibendum, ligula diam blandit diam, vel rhoncus purus sapien non mi. Aenean a convallis arcu. Phasellus non est mollis eros lobortis vestibulum consequat ac arcu. Fusce justo urna, ultrices ut varius a, eleifend ac justo.

    It still not working. It prints out:

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce porta diam in quam consectetur elementum. Vestibulum iaculis pellentesque mauris, non sodales erat egestas nec. Proin sed elit sed ligula ullamcorper adipiscing. Quisque pellentesque sapien odio. Phasellus nec elit ligula. Ut tempus urna ut lectus ullamcorper imperdiet.

    Quisque vitae massa sem, sed cursus sapien. Ut mi lorem venenatis nisl lacinia id. Suspendisse eget magna turpis. Aenean rhoncus, mauris nec ullamcorper bibendum, ligula diam blandit diam, vel rhoncus purus sapien non mi. Aenean a convallis arcu. Phasellus non est mollis eros lobortis vestibulum consequat ac arcu. Fusce justo urna, ultrices ut varius a, eleifend ac justo. Sed ornare rhoncus turpis sed accumsan. Curabitur dignissim, justo id facilisis elementum, mauris orci convallis augue, non

  18. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Are you using the rich-text editor, or the HTML editor?

    If you're using the HTML editor, you would add the <!--more--> tag manually.

    If you're using the rich-text editor, you would use the "More" button on the editor toolbar.

  19. davy_yg
    Member
    Posted 2 years ago #

    yes, I am using wordpress rich text editor.

    I have press th more button. and this symbol appear: <!--more-->

    Yet, still I do not see the more in the wordpress content. The same output like my previous post.

  20. davy_yg
    Member
    Posted 2 years ago #

    Strange, it also does not work with other themes. I have tried switching themes to twentyten add <p><?php the_content("Read more..."); ?></p>

    and press more in between content. <!--more-->

    Still the output remains the same, without the "Read More".

    Can ANYONE help me ?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.