• Resolved Dennis Bareis

    (@dbareis)


    What I’d like to do is similar to a #define (in C/C++ etc), and then using that template in many places. I tried Reusable Blocks but I don’t want a block I want to imbed the value inline with other content around it.

    The first thing I’d like to do is define a street address somewhere:
    #define StreetAddress 12 Xyz St, SomeCity etc

    And then use that in a say a paragraph block:
    .. blah blah shop at "{{StreetAddress}}".

    If the address changes that only needs a single place to be updated. I also looked at short codes but they also appear to be for blocks.

    • This topic was modified 1 year, 11 months ago by Dennis Bareis.
Viewing 3 replies - 1 through 3 (of 3 total)
  • I also looked at short codes but they also appear to be for blocks.

    That’s a definite NO.

    Shortcodes were around long before blocks even came into existence. And if you don’t want to use a 3rd-party plugin, creating shortcodes might be the way to go: https://developer.www.ads-software.com/reference/functions/add_shortcode/

    If you’re going to create a lot of these “text fragments”, you probably want a dashboard UI to be able to easily add/edit/remove the fragments.

    You may write your own little plugin to do this, or use a plugin like Shortcoder or WPCode. I’ve tested both plugins and they both worked out of the box: you give the plugin your text (for inline text, be sure to select HTML or Code editor), and they spew out a shortcode you can use anywhere on your site. And you can generate as many of these shortcodes as you desire.

    Thread Starter Dennis Bareis

    (@dbareis)

    Thanks for the information, I will use “Shorcutter” (at least for now) as the basic version allows aliases and I don’t have to get anyone to approve a purchase.

    A quick summary of the two products:

    [wpcode id="4299"]
        Alias Needs Pro version (otherwise random? number like 4299")
        Recently updated, many more users/
        Seems more powerful
        PRO: $99/year for one site (currently $49)
    [sc name="streetaddress"][/sc]
        Alias Always lower case
        Alias Free
        Recently updated, less users
        PRO: $25 once off for one site, lifetime support (but: Updates for 1 year)
    • This reply was modified 1 year, 11 months ago by Dennis Bareis.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to Reuse Text Fragments (not blocks)’ is closed to new replies.