how to add text to posts from tags

How can I add custom generated text to posts using text from tags?

Something like:
[Post Title] + custom text + tags + custom text ….

Read More

Or is there a plugin which does this ?

Related posts

Leave a Reply

1 comment

  1. There is no plugin for that… at least one plugin 🙂

    Create custom fileds for your custom text. Install ACF plugin (advanced custom fields) from wordpress.org.

    Now… create a field group with ACF and then create custom fileds inside that group for your custom text 1 and custom text 2. (Don’t forget to assign field group to post and/or pages.)

    Use

     <?php the_field('custom_text_1'); ?>
    

    and

     <?php the_field('custom_text_2'); ?>
    

    inside page/post template to display your custom text 1 and custom text 2.

    You can try to call tags with get the tag list

    <?php
    echo get_the_tag_list('<p>Tags: ',', ','</p>');
    ?>
    

    Finaly, you can call Title with

    <?php the_title(); ?>
    

    So… just place this snippet inside your template on place where you want to show your record:

    <?php the_title(); ?> <?php the_field('custom_text_1'); ?> <?php echo get_the_tag_list('<p>Tags: ',', ','</p>'); ?> <?php the_field('custom_text_2'); ?>
    

    You can change custom_text_1 and custom_text_2 with records of your choice, but they must to be the same as you create them inside ACF.

    If you want to display your record inside content area of your post or page, you can use any another plugin which can help you to create [short code] for given snippet.