0

I create posts in which similar text is repeated to me.
Therefore, I would like to make my work easier, and therefore I want every new post to already contain this text.

Example:
Each posts contains the following headings, under which the text that is specific to each post will proceed.

<h2> Keywords </h2>

<h2> Similar articles </h2>

Where should I insert the predefined text to be included in each new post?
I'm looking for a solution for new posts, not new pages.
But it would be interesting to see a solution for new pages as well.

My research

I should probably edit the single.php file, but I didn't find where to insert the text.

1
  • 1
    Would reusable blocks be what you need? Otherwise, a custom plugin that hooks something or other as the new post page loads? Jan 15 at 17:56
1

you can insert it in single.php.

find the_content; and that is your content, you can insert above or below the_content;

5
  • single.php in my theme does not contain "the_content". I use GeneratePress V 2.4.2. Just like this ` get_template_part( 'content', 'single' ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || '0' != get_comments_number() ) : /** * generate_before_comments_container hook. * * @since 2.1 */ do_action( 'generate_before_comments_container' ); ?> <div class="comments-area"> <?php comments_template(); ?> </div> <?php endif; `
    – Ogi22
    Jan 15 at 15:14
  • so you can insert it above or below get_template_part( 'content', 'single' ); then
    – Tiyo
    Jan 15 at 16:02
  • Can you give an example please?
    – Ogi22
    Jan 15 at 17:12
  • I tried to put in there, <h2> foo </h2> but nothing happened.
    – Ogi22
    Jan 15 at 17:22
  • You can also open the content-single.php and in there you'll find the_content() and can add it that way. Tiyo's answer is technically correct, you just have to figure out where specifically in your theme you need to do this. Jan 15 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.