• For the [loop] shortcode, there is a nice parameter called “blog” to retrieve content from another instance in a multisite environment.

    Now I have an issue in an installation that a list of categories should be retrieved in a widget – namely from another multisite instance.

    That is: In the [for] command there is no possibility to select the multisite instance as it is possible with [loop].

Viewing 1 replies (of 1 total)
  • Cool! Finally a discussion on multisite cross content. So far only loop & loop-count work with blog=id for me.

    I’ve tested with diff conditions with for/each by adding blog=id, and found out if both blog sites has the same CPT, custom tax and exact fields, as long as the child/client site has the term name saved exactly like the main site, it’s able to pull custom tax fields from the main site, while the term’s slug/id make reference to child’s native saved tax.

    Another example that I’m using and it’s working for me: *say the main site is blog=1

    [for blog=1 each=customtax]
    [set cterm][each slug][/set]
    [pass vars]
    [loop blog=1 type=cptpost taxonomy=customtax term={CTERM} fields=title,desc]
    {TITLE}: {DESC}
    [/loop]
    [/pass]
    [/for]

    Both for and loop must include blog=id parameter; if either 1 is left out will break the result. I don’t have clear explanation why this happens but that was what I got from my testing results.

    If more complicated conditional logic is needed to apply for creating content, the workaround I use is to move the CCS to an external file and then save it as php file in a child theme folder. and then either load the file using get_template_file when using a template file, or use [load] shortcode in text editor.

    Note:
    pls take note applying CCS across multisites will have deep nested [loop] and [for], probably many nested [if] too.

    Tips that helps me :
    i also discovered by adding – nested syntax eventhough it’s not required will not interfere the contents. But if nested syntax isn’t apply when it is needed definitely breaks the code. So what I do when I create snippets that has a pass: I always add a level down nested syntax to avoid code breaking if code before the snippet has changes such as adding a pass into the whole loop / for.

    Then again if the whole thing gets too complicated, always work it out by using the standard wp codex format.

Viewing 1 replies (of 1 total)
  • The topic ‘Choosing a blog in a multisite environment through [for]’ is closed to new replies.