WordPress.org

Ready to get started?Download WordPress

Forums

Is there a plugin for this? (6 posts)

  1. jeffb0
    Member
    Posted 5 years ago #

    Howdy! I have been unable to find what I'm looking for in the plugin db...

    I have some common text/html that I want to use on several posts and pages throughout my site. I'd like to be able to just insert a [tag] into my post and have the content I've assigned to [tag] magically appear in my post.

    Know what I mean? :-)

  2. kkarpieszuk
    Member
    Posted 5 years ago #

    here you have solution, if i understand you well :)

    http://codex.wordpress.org/Shortcode_API

    tis is not plugin, this is api to insert [shortcode] inside of page. i hope you can code in PHP :)

  3. jeffb0
    Member
    Posted 5 years ago #

    Thanks very much, but unfortunately I can't code in PHP and was really hoping there was a plugin for that.

    As an example, I have this paragraph of text I want to use on four posts on my site:

    "blah blah blah."

    I'd like to assign the above paragraph a variable [blah] and be able to insert it into my four posts by just using the tag, [blah].

  4. kkarpieszuk
    Member
    Posted 5 years ago #

    in your theme folder find (or create) file functions.php

    write inside:

    <?php
    function put_this_text() {
    return 'here write this text, which you want to have in diffrent places many times';
    }
    add_shortcode('myowntext', 'put_this_text');
    ?>

    And now, if you will place in blog post [myowntext] it will be replaced by the text which you have above after return

  5. jeffb0
    Member
    Posted 5 years ago #

    Ooooh, fancy! :-)

    I'd much prefer a plugin for this functionality, but if that's the only way... so be it. I very much appreciate your help.

  6. kkarpieszuk
    Member
    Posted 5 years ago #

    maybe plugin is available, but i dont know it :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.