Site logo

[Resolved] Read more CSS is adding it to the bottom on post

Home Forums Support [Resolved] Read more CSS is adding it to the bottom on post

Home Forums Support Read more CSS is adding it to the bottom on post

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1851318
    Bob

    In another thread here I found and it was recommended to use this CSS in order to give some padding and move the read more link to the right

    .read-more-container {
    margin-top: 10px;
    text-align: right;
    }

    As a a result I am finding it now at the end of full posts. For example if you scroll down to the end of this post you will find it there in the bottom right corner. Any idea why? Thanks!

    #1851379
    Leo
    Staff
    Customer Support

    Hi there,

    Not sure if I fully understand.

    So basically you don’t want that CSS to apply to single posts?

    If so edit it to this:

    .blog .read-more-container, .archive .read-more-container {
        margin-top: 10px;
        text-align: right;
    }
    #1851622
    Bob

    Thanks Leo, yes that is exactly what I want. I don’t understand why anyone would ever want that at the end of a full post 🙂 Oddly enough when I changed this CSS is moves it to the left but it remains on full posts. Something to add that would take it off of the full post?

    #1851976
    Ying
    Staff
    Customer Support

    Hi Bob,

    I don’t think the read more container is added to a single post by default, are you using a custom template or custom function?

    Can you try to disable all plugins except GP Premium? And if you are using a child theme, can you switch back to the parent theme?

    Let me know 🙂

    #1851998
    Bob

    Okay, so I found the problem but not sure what to do.

    Awhile back I was not able to get my “read more” on my archives page. I believe I had either found it here somewhere or was instructed through this forum, but I was told to add this snippet which I did.

    add_action( ‘generate_after_entry_content’, ‘tu_static_read_more_button’ );
    function tu_static_read_more_button() {
    ?>
    <p class=”read-more-container”>
    ” “>Read more
    </p>
    <?php
    }

    Now when I disable that snippet, the “read more” disappears from the single post, but it now also doesn’t show on my archives page, which brings back an old problem 🙁 Any suggestions?

    Previously when checking that I had disabled all plugins and that didn’t resolve the older problem either.

    #1852013
    Ying
    Staff
    Customer Support

    I see what’s the issue, can you try this PHP snippet instead of the one you are using currently:

    add_action( 'generate_after_entry_content', 'tu_static_read_more_button' );
    function tu_static_read_more_button() {
    ?>
        <?php if ( is_home() || is_archive() ) : ?>
            <p class="read-more-container">
                <a href="<?php the_permalink(); ?>" class="button">Read more</a>
            </p>
        <?php endif; ?>
    <?php
    }

    Let me know 🙂

    #1852018
    Bob

    Yay, that did it. Thanks! One last question… I think also part of the reason for that snippet was also to remove the button on the read more in the archives. Because now that is back LOL. I think that was another needed fix because even though I have it untoggled in the customizer for archive, they are still showing. Is that last fix possible (seems like ti never ends huh 🙂

    #1852182
    Ying
    Staff
    Customer Support

    Do you just want the read more on the blog page, not archive pages?

    #1852227
    Bob

    No, it just appeared on the blog page and that doesn’t make sense to have it there.

    I want it only on the archives and no button, only text. Does that make sense. I added the CSS to move it to the right and down a bit.

    #1852235
    Elvin
    Staff
    Customer Support

    Hi Bob,

    No, it just appeared on the blog page and that doesn’t make sense to have it there.

    You can modify Ying’s PHP snippet so it only appears on archive pages and not the blog pages. Simple remove is_home() || from the if condition.

    I want it only on the archives and no button, only text. Does that make sense. I added the CSS to move it to the right and down a bit.

    The PHP has class="button" that turns it into a button. We can remove that as well.

    Try this.

    add_action( 'generate_after_entry_content', 'tu_static_read_more_button' );
    function tu_static_read_more_button() {
    ?>
        <?php if ( is_archive() ) : ?>
            <p class="read-more-container">
                <a href="<?php the_permalink(); ?>">Read more</a>
            </p>
        <?php endif; ?>
    <?php
    }
    #1852237
    Bob

    Excellent, thank you so much. That did the trick. Cheers!!

    #1852245
    Elvin
    Staff
    Customer Support

    No problem. Glad to be of any help. 😀

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.