WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
imagelist not working in posts (10 posts)

  1. darklined
    Member
    Posted 3 years ago #

    I am trying to insert an imaglist into a post using the code [nggallery id=x] (where x is the gallery ID of course) but for some reason the tag is not parsed and instead of the imagelist the post outputs the code ([nggallery id=x]). Everything works fine in a page, but not in a post.

    After trying the code for slideshow or imagebrowser I got the same result - the code isn't parsed but still part of the output. So for some reason NextGEN only works in a page, but not in a post? What am I doing wrong?

  2. medinauta
    Member
    Posted 3 years ago #

    Did you checked if is the text editor that is scaping the code?
    Try to write the code in html mode, save it and check.

  3. darklined
    Member
    Posted 3 years ago #

    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 ...

  4. darklined
    Member
    Posted 3 years ago #

    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 :(

  5. ps4482
    Member
    Posted 3 years ago #

    I have the same problem. Works on pages, but not posts. I'm in version 3.01.

  6. darklined
    Member
    Posted 3 years ago #

    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.

  7. darklined
    Member
    Posted 3 years ago #

    *desperation bump*

    Anyone?

  8. Carlos Lara
    Member
    Posted 3 years ago #

    I have the same problem, did you foun something about it ?

    Thank you

  9. darklined
    Member
    Posted 3 years ago #

    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.

  10. Carlos Lara
    Member
    Posted 3 years ago #

    Great!!

    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.