Forums

[resolved] auto add a text to a post (3 posts)

  1. mxmx
    Member
    Posted 2 weeks ago #

    Hi,

    I am looking for a plugin or piece of code that can add a piece of text to every post on my blog automatically. The text needs to include the title of the post, so here's an example of what I am looking for.

    Thanks for reading <post title>. see you again.

    The plugin needs to do this automatically for every single post I submit. I don't wanna do it manually.

    Thanks for your help and time.

    Regards

  2. MichaelH
    moderator
    Posted 2 weeks ago #

    With the help of the Template Hierarchy article, determine what Template is displaying your posts (could be index.php, single.php, archives.php). Then add that text to the code displaying your title.

    With the WordPress Default theme, ONE of the files you would change would be wp-content/themes/default/index.php. You would change:

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    to this:

    <h2>Thanks for reading <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>. See you again.</h2>

    You will probably need to do that in several template files.

  3. mxmx
    Member
    Posted 2 weeks ago #

    Thanks!

    It worked!

Reply

You must log in to post.

About this Topic