Site logo

Archived topic

Inserting standard text in posts

23 replies · Started by Tom on May 4, 2022

Viewing posts 16–24 of 24

Try generate_after_content for this copy.

It matches your content container, but your CSS which set elements within entry content to be 700px doesn't apply to this hook.

How did you add this text? Are you using a hook element with HTML or a block element?

You need to give the text a class, so we can add this class to your existing CSS:
https://www.screencast.com/t/POqu07qd

was just using html

can you send that css as text instead of a screen shot?

So you can add class like this:

<p class="affiliate-notice"><em>your-text</em></p>

Then edit your CSS to:

.entry-content p, .entry-content ul, .entry-content ol, .entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content > div, .entry-content blockquote, .comments-area, .affiliate-notice {
    max-width: 700px;
    text-align: left;
    word-wrap: break-word;
    margin-left: auto;
    margin-right: auto;
    clear: both;
}

that works perfectly for line length

is there a location so I can put it above the meta info?

Thanks so much.

Tom

In that case, switch to genearate_after_entry_content hook, set the priority to 1.

Perfect.

Thanks so much.

Now, one last (I hope) question.

Can I use this scheme to put similar content under the first photo and caption in a post? Is there a location for that, or can we invent one?

Hi Tom,

If you would like to hook to any location in your post, you may create a Portable Shortcode. Kindly see my response here on how to do it: https://generatepress.com/forums/topic/adding-an-automatic-disclaimer-to-my-posts/#post-2154753

If you would like to automatically add it after every first image on a post, here is the way to do it: https://generatepress.com/forums/topic/adding-an-automatic-disclaimer-to-my-posts/#post-2154785

Hope this clarifies. Kindly let us know if further assistance is needed. :)

This archived topic is closed to new replies.