WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Remove "read more" from sticky post only

[Resolved] Remove "read more" from sticky post only

  • easylifespain

    @easylifespain

    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”

Viewing 15 replies - 1 through 15 (of 19 total)
  • Hampton Paulk

    @hamptonpaulk

    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.

    easylifespain

    @easylifespain

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

    Hampton Paulk

    @hamptonpaulk

    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

    esmi

    @esmi

    Forum Moderator

    easylifespain

    @easylifespain

    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.

    Hampton Paulk

    @hamptonpaulk

    esmi has it on this one.

    easylifespain

    @easylifespain

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

    esmi

    @esmi

    Forum Moderator

    Check out the comments in that code example.

    easylifespain

    @easylifespain

    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.

    esmi

    @esmi

    Forum Moderator

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

    easylifespain

    @easylifespain

    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???

    esmi

    @esmi

    Forum Moderator

    <?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; ?>
    easylifespain

    @easylifespain

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

    easylifespain

    @easylifespain

    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.

    esmi

    @esmi

    Forum Moderator

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

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘[Resolved] Remove "read more" from sticky post only’ is closed to new replies.
Skip to toolbar