WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove "read more" from sticky post only (20 posts)

  1. easylifespain
    Member
    Posted 2 years ago #

    I have set a sticky post for my homepage but want to display the entire post but keeping all other posts on the home page as showing excerpts and "read more"

  2. Hampton Paulk
    Member
    Posted 2 years ago #

    In your template for the homepage make sure you are using the_content() and not the_excerpt(). If this is does not work for you, please post some code from the template here so we can help you easier.

  3. easylifespain
    Member
    Posted 2 years ago #

    Not sure i fully follow you, where am i looking for this code, in the loop?

  4. Hampton Paulk
    Member
    Posted 2 years ago #

    Correct, in your loop you should find either the_content or the_excerpt.

    Find what page you should edit by looking at this - http://codex.wordpress.org/Template_Hierarchy

  5. esmi
    Forum Moderator
    Posted 2 years ago #

  6. easylifespain
    Member
    Posted 2 years ago #

    If i use the_content() in the loop it will show the full content of all posts. This is not what i am looking for. I only want the sticky post to display the entire content. The remaining posts i want to display the excerpt.

  7. Hampton Paulk
    Member
    Posted 2 years ago #

    esmi has it on this one.

  8. easylifespain
    Member
    Posted 2 years ago #

    Thanks esmi. Where in the loop do i put this code?

  9. esmi
    Forum Moderator
    Posted 2 years ago #

    Check out the comments in that code example.

  10. easylifespain
    Member
    Posted 2 years ago #

    Maybe its me but actually the comments are what is confusing me.

    // Declare global $more (before the loop)
    // Set (inside the loop) to display all content, including text below more.

    So is that inside the loop or before the loop or part before and part after.

  11. esmi
    Forum Moderator
    Posted 2 years ago #

    global $more; goes before the Loop.
    $more = 1; is declared inside the Loop

  12. easylifespain
    Member
    Posted 2 years ago #

    Thanks for your patience esmi but i still don't think i get it.

    <?php
    if (is_sticky()) {
    global $more;

    goes before the loop and the rest of the code goes inside the loop???

  13. esmi
    Forum Moderator
    Posted 2 years ago #

    <?php global $more;
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    if (is_sticky()) $more = 1;
    else $more = 0;?>
    [...]
    <?php the_content();?>
    <?php endwhile; endif; ?>
  14. easylifespain
    Member
    Posted 2 years ago #

    perfect, that makes sense now. Thanks for your patience esmi!!!

  15. easylifespain
    Member
    Posted 2 years ago #

    Sorry but this still isn't working out for me. If you have the time, can you check it out http://www.mijasguide.com/

    Now its displaying the sticky post in double.

  16. esmi
    Forum Moderator
    Posted 2 years ago #

    That looks like the initial text isn't part of the main Loop.

  17. easylifespain
    Member
    Posted 2 years ago #

    I've removed it now but the code was placed after <?php while ( have_posts() ) : the_post(); ?>, which i thought was the start of the main loop.

    There is no sticky() in my loop.php file

  18. esmi
    Forum Moderator
    Posted 2 years ago #

    Right, I think I see what the problem was. You were meant to adapt your Loop using the example code as just that - an example. Not add it "as is" to your Loop.

  19. easylifespain
    Member
    Posted 2 years ago #

    Ah ok, back to the drawing board then.

  20. veliapola
    Member
    Posted 2 years ago #

    I am also trying to remove "read more" from my sticky post. I am using Magazine Basic theme, WordPress 3.3.2 and the loop.php file has me stumped trying to find where to put what before and after. I keep breaking my test site (http://golfforethegood.org/1_test), obviously not placing new code properly. Too complex for my wordpress experience. Can anyone assist? Thanks. loop.php file is HUGE so I was prompted to use pastebin. Code here http://pastebin.com/Yuqf9rq3

Topic Closed

This topic has been closed to new replies.

About this Topic