darklined
Forum Replies Created
-
All I can offer is a workaround. In my single.php instead of just outputting the content I first call the do_shortcode function.
$content = get_the_content(); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]& gt;', $content); // Note: remove the space between & and gt ... echo do_shortcode($content);
Not the most satisfying solution, but for now it works.
Sounds like the same problem I have and posted about here. Unfortunately my problem never was solved (and still persists) ??
Is the
<?php echo get_the_content(); ?>
workaround a usable solution or does it have disadvantages?EDIT: Just tried
<?php echo get_the_content(); ?>
, but it doesn’t work for me. The shortcode doesn’t get replaced ??*desperation bump*
Anyone?
Ok, did some more digging around. I am almost sure it has something to do with the shortcode handling of WP.
I have a post and a page which have exactly the same content, both ending with
[nggallery id=x]
. On the page the NextGEN code gets replaced correctly, on the post it remains in the output. Diving further into both WP’s shortcode.php and NextGEN’s shortcode.php I can verify that in both cases all functions get called, all attributes are parsed correctly, the regular expressions used are absolutely identical and the callback functions returns the same (correct) output. The only difference is that the shortcode in the post doesn’t get replaced – despite using the same regular expression as the page, getting the same input, callback functions returning the same output …What’s the difference between a post and a page that could have this effect?
I am at a loss. Any help would be greatly appreciated.
Did some testing to see if other plugins might affect NextGEN (I am running YAPB too for example), but still no luck. Other plugins apparently have no effect on the parsing (or not parsing …) of the code.
Any ideas? I’d really like to use NextGEN in posts and not only in pages ??
Usually I use HTML mode so it is not the text editor. Just to be safe I tried several ways:
- writing the code manually (or copying from a page where it works) in HTML
- writing the code manually (or copying from a page where it works) in visual
- using the NextGEN dialog to insert a gallery (tried all variants (list, browser, slideshow), result is always the same – the code is outputted)
At first I thought that maybe the plugin wasn’t called when a post is parsed so the code doesn’t get replaced in the output. I tried the old way to insert a NextGEN gallery using the code
[gallery=x]
but this outputs [nggallery id=”x”] so apparently the plugin is called and does … something. Just not what it is supposed to do …