[content id=…] for multi-site?
-
Eliot, is this possible to import content from different blog in WP multisite instalation to another using shortcode [content] ?
-
There is an undocumented shortcode called
[get-blog]for switching blogs on multisite:[get-blog id=3] [loop type=post count=3] [field title-link] [/loop] [/get-blog]At the moment, I don’t have a multisite install to test it on, but you can see if it actually works..!
I’ve just tested this on my multisite installation and it works.
[get-blog id=4]
[loop type=post]
[field title-link]
[/loop]
[/get-blog]But when I try this more complex code, I get blank result:
[get-blog id=4]
[for each=”tipi” link]
[each link]
[loop type=”post” count=”-1″]
[field title-link]
[/loop]
[/for]
[/get-blog]In blog 4 I tested the single code:
[for each="tipi" link] [each link] [loop type="post" count="-1"] [field title-link] [/loop] [/for]and it works perfectly.
In main main blog (id=1) I tested:
[get-blog id=4] [for each="tipi" link] [each link] [loop type="post" count="-1"] [field title-link] [/loop] [/for] [/get-blog]and it doesn’t work.
Maybe I make a mistake in using get-blog shortcode in the right way. Can you help? Thanks
The get-blog shortcode is super simple, it switches to the blog by ID; runs the shortcode inside; then restores the original blog. So I’m not sure why it’s not working for you. Maybe you can test which shortcode is having the issue: is normal post loop working without for/each?
[get-blog id=5]
[content id=191 import=true]
[/get-blog]is working.
OK, thanks for confirming that it works.
Yes, it works with [content…] and [loop..] shortcodes, but not with [for each…].
Maybe there is another way to obtain what I need?In a multisite environment, I need a list of all custom term of a custom taxonomy defined in another blog.
tipi
is the custom taxonomy
So I tryed this code:
[get-blog id=4] [for each=tipi empty=true] Custom Term: [each name] [/for] [/get-blog]But it doesn’t work, displays nothing
Interesting that it’s only the taxonomy loop that doesn’t work. Not sure how I can help, the shortcode as I described just calls switch_to_blog and restore_current_blog. According to the Codex here, some things are not switched: “autoloaded options, plugins, the object cache”. Do you have a cache plugin running?
Another thing you could check: does the [for each] loop work as expected on the specified blog #4?
franzitta maybe you can generate it on new blank page on blog 4 and after that import this whole efect using [content ?
Thanks Jakub for your solution.
In blog #4 [for each] shortcode works perfectly.
I’ve no caching plugin installed in my multisite wp.Anyway, I agree with you Eliot, it’s really strange.
The strange thing is that if I put this code:
[get-blog id=4] [for each=tipi empty=true] Custom Term: [each name] [/for] [/get-blog]in the content of a page (with id=58) in blog #1, it doesn’t work, but if then I run this code in blog #4:
[get-blog id=1] [content id=58] [/get-blog]I can see all the terms of ‘tipi’ taxonomy.
I want to investigate better on the reasons why it doesn’t work.
I think that Custom Content Shortcode is one of the best plugin I’ve ever used, so I want to give you any kind of support that would improve its funcionality.Thanks for your support!
The topic ‘[content id=…] for multi-site?’ is closed to new replies.