Archived topic
How to add standard text at end of a post/page
15 replies · Started by Rachel on September 5, 2018
Hi,
I would like to add some standard text in italics at the base of most posts and some pages.
I have played with the different hooks but can't find one that will place the text at the end of the post content but before my social share icons.(social warfare)
The after_content hook displays after the post category meta and the social shares, the after_main_content appears after comments box.
Could you please advise which hook will display in the area I am trying to add to?
Thanks,
Rachel
Hi there,
so by default Social Warfare filters the_content to place their icons.
So instead you could use the SW shortcode:
https://warfareplugins.com/support/using-shortcodes-and-php-snippets/
Then you could try adding your type followed by the shortcode inside the after_content hook and change the priority to a lower number (it defaults on 10). This should hook it above the entry meta.
hmm, I can't seem to get anything to display when using the after_content hook. I am not tech, so do I need to code the shortcode in a certain way within the hook to display correctly?
If you're using the GP Elements > Hook then you just need to Check the Execute Shortcode and set the Display Rules.
https://docs.generatepress.com/article/hooks-element-overview/
Ok, did that. It is now showing above the SW social share, but still below the meta tags with the priority set to 1. Not sure how to get it to hop above the meta data- any ideas?
Hi there,
Try the generate_after_entry_content hook instead with a low priority.
Let me know :)
Hooray - that worked. Thank you. Sorry for the very basic questions, but can you advise how I can adjust the text font and colours of the text in this hook? Is there a place I can find the class for certain styles? Thanks.
You can add an element with a class around your content, then apply CSS to it:
<div class="my-element">
My content
</div>
Then your CSS:
.my-element {
color: #777777;
}
Thank you! I really need to find a good intro to css course...
Codecademy is pretty cool: https://www.codecademy.com/
Thanks for the tip. Cheers.
No problem :)
Hi, So I have been using this element to add standard text to the bottom of posts, but it doesn't show up for pages. I have set the custom hook element with the display rules all singular, plus added individual pages in the location section, but no luck.
Is there a way I can specify this hook to be displayed at the base of specific pages? Thanks.
Hi there,
you would need to create a separate Element Hook and use one of the available hooks for the static pages, this guide displays where they are:
https://docs.generatepress.com/article/hooks-visual-guide/#static-page
Ok, thanks - that worked. Cheers. Will save that link for later!