• I’ve searched, I can’t find answers, not from lack of hits, but because:

    1. there’s too many hits (searching on “text file”), and
    2. I don’t know what to call it.

    I have three text paragraphs, A, B, C. 12 sites use all three paragraphs, but only paragraph B changes four times a year.

    Can a single, .txt file be used as the master “B” block, by changing it once in one file, it’s immediately readable by all 12 sites? One-file licensing updates that apply to multiple WP installs.

    What’s the name for that strategy?

    • This topic was modified 7 years, 2 months ago by d0ugparker.
Viewing 3 replies - 1 through 3 (of 3 total)
  • There’s no real “strategy” for that, but I’d probably refer to it as “including” a file.

    The WordPress way to do this would be to set up a new shortcode and have that read in a contents of that text file and then display it. There’s several ways of doing this, but this is one (not tested) way of doing it:

    function my_include_shortcode() {
        return file_get_contents ('http://example.com/mttextfile.txt');
    }

    That’s the easiest way of doing it, but it may need some tweaking to work depending on your server environment.

    Thread Starter d0ugparker

    (@d0ugparker)

    Hmm…and if it’s a multi-site install, the same applies? I don’t have the smarts to pick apart its subtleties in getting it to work in multiple sites.

    I did find a foo-bar demo somewhere (that correctly echoed the words foo and bar in the correct location) that worked on a single wp install, but I haven’t tried it on a multi-site install.

    It should be the same. As far as I’m aware there’s nothing different in a Network set up that would change the way the code that I gave above would work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Single .txt file for a dozen sites’ is closed to new replies.