• Resolved paddyinthesun

    (@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.

    Thread Starter paddyinthesun

    (@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 – https://codex.www.ads-software.com/Template_Hierarchy

    esmi

    (@esmi)

    Thread Starter paddyinthesun

    (@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.

    Thread Starter paddyinthesun

    (@easylifespain)

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

    esmi

    (@esmi)

    Check out the comments in that code example.

    Thread Starter paddyinthesun

    (@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)

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

    Thread Starter paddyinthesun

    (@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)

    <?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; ?>
    Thread Starter paddyinthesun

    (@easylifespain)

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

    Thread Starter paddyinthesun

    (@easylifespain)

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

    Now its displaying the sticky post in double.

    esmi

    (@esmi)

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

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