- This topic has 11 replies, 4 voices, and was last updated 4 years, 11 months ago by
Elvin.
-
AuthorPosts
-
July 10, 2021 at 6:34 pm #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!
July 10, 2021 at 9:54 pm #1851379Leo
StaffCustomer SupportHi 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; }July 11, 2021 at 6:08 am #1851622Bob
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?
July 11, 2021 at 10:22 am #1851976Ying
StaffCustomer SupportHi 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 🙂
July 11, 2021 at 10:47 am #1851998Bob
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.
July 11, 2021 at 10:58 am #1852013Ying
StaffCustomer SupportI 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 🙂
July 11, 2021 at 11:03 am #1852018Bob
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 🙂
July 11, 2021 at 4:33 pm #1852182Ying
StaffCustomer SupportDo you just want the read more on the blog page, not archive pages?
July 11, 2021 at 6:23 pm #1852227Bob
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.
July 11, 2021 at 6:43 pm #1852235Elvin
StaffCustomer SupportHi 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 }July 11, 2021 at 6:46 pm #1852237Bob
Excellent, thank you so much. That did the trick. Cheers!!
July 11, 2021 at 7:11 pm #1852245Elvin
StaffCustomer SupportNo problem. Glad to be of any help. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.