Archived topic
Inserting standard text in posts
23 replies · Started by Tom on May 4, 2022
Is there any way to automatically insert copy at the top and bottom of all posts?
I tried using a hook, but can't seem to get it to format correctly (like the post) and land in the correct location (within the copy, at top and bottom.)
site is https://travelpast50.com.
Thanks.
Hi there,
it is - but we need to consider where does Copy start and stop.
Lets first look at after the content ... if i look at a single post i see the posts end with a Blue Box, Disclaimer, CovertKit form and Social Icons. Do you want to hook in after that or before that ?
I'd replace the blue box at the end with the text I want to insert. So, the last thing in the body of the post would be the text I want to insert.
At the top, I'd want the text to be, in essence, the first sentence of the post.
I'd like to be able to format the text, i.e. put it in a blue box and italicize.
What I'm trying to do is automate placement of disclaimer text and a couple of other things in all posts.
Thanks.
So how are the ConvertKit and Social Icons added to the page ? Is that automatic ?
If it is can they be added using Hooks and Shortcodes ?
both via plugins.
Convert Kit has it' own. The social icons are from Grow Social Pro by Mediavine.
Do those plugins have an option to insert using a shortcode ?
As ( i assume ) they are currently using the_content filter hook to insert their code, which makes it impossible to use an ( action ) hook to insert content before them.
I'll have to check with ConvertKit. It seems you can use their shortcode, according to the settings in their plugin, but seems to suggest using it in addition to the app inserting the form at the end.
As for mediavine, don't see it in their plugin. I will ask their support, too.
So I understand, if we could do both via shortcode, then we could do the text insert?
Thanks.
Thats correct, as then you could use a Hook to add your Blue Box text, followed by the ConvertKit Shortcode and then the Social Sharing shortcode :)
For the top of the Post, we have a similar challenge.
For example if you were to use the generate_after_entry_header hook you could place content after the Title/Post Meta.
Anything below that is in the content so we would need to use a filter to insert content. Let me know.
Got an answer from convertkit. I can insert a shortcode to display the form.
As a hook?
Where do I put it?
I want it to be the last thing at the bottom of posts.
generate_after_content seems to work.
That's how I'm doing it as of now.
Using the plugin settings, I've stopped showing the social share buttons at the bottom. Will that do the trick, at least for the bottom?
Hi Tom,
I want it to be the last thing at the bottom of posts.
Givegenerate_before_comments_container hook a try.
Both generate_before_comments_header and generate_after_content seem to put the form in the same place. Is there any benefit to one or the other as far as inserting the text I want?
generate_before_comments_container
This hook should insert the content after the social share icon. Isn't that what you want?
Let me know if I miss anything.
Ok. The Convertkit form is in the right place.
Now I want to place this copy
Some posts on this site contain affiliate links, meaning if you buy something through one of those links, Travel Past 50 may earn a small commission.
above that, in the same format as the normal copy. How do I make it the same width? If I put it in like this, it displays full container width.