• I am using the latest version of NGG.

    In my theme, I have a shortcode that gets the content from a post and then adds the_content filter to it.

    If I use that shortcode within the post and then use the NGG gallery shortcode e.g

    <img class="ngg_displayed_gallery mceItem" alt="" src="https://avadatest.theme-fusion.com/nextgen-attach_to_post/preview/id--4687" />
    
    [ngg_images gallery_ids="1" exclusions="" display_type="photocrati-nextgen_basic_thumbnails" thumbnail_width="120" thumbnail_height="90"]

    The shortcode fails to parse and and this is what I get within the page content https://cl.ly/image/1k2e0d2Z143j however if I remove the shortcode that has the_content filter $content = apply_filters('the_content', $content); the shortcodes start to work again.

    I found out that if I remove add_filter('the_content', array(&$this, 'deactivate_all'), 1); from NGG shortcode manager class, the shortodes work when multiple the_content filters are applied.

    Are you guys going to consider fixing this?

    https://www.ads-software.com/plugins/nextgen-gallery/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @muhammad – Without knowing what the shortcode you are using is, we probably would not be able to discern why it is not parsing the NextGEN Gallery shortcode, as I can easily put a NextGEN Gallery shortcode inside another shortcode that will correctly parse the exact example shortcode you are using.

    – Cais.

    Thread Starter Haris Zulfiqar

    (@isharis)

    This will happen for any shortcode that has the the_content applied to the content.

    Try adding the following shortcode in your theme:

    add_shortcode('shortcode', 'shortcode');
    function shortcode($atts, $content = null) {
    
    	$posts = new WP_Query('showposts=10');
    
    	while($posts->have_posts()): $posts->the_post();
    
    	$content = get_the_content();
    	$content = apply_filters('the_content', $content);
    
    	var_dump($content);
    
    	endwhile;
    
    }

    And then create a new page with the following content:

    [shortcode][/shortcode]
    
    <img class="ngg_displayed_gallery mceItem" alt="" src="https://avadatest.theme-fusion.com/nextgen-attach_to_post/preview/id--4687" />
    
    [ngg_images gallery_ids="1" exclusions="" display_type="photocrati-nextgen_basic_thumbnails" thumbnail_width="120" thumbnail_height="90"]
    Thread Starter Haris Zulfiqar

    (@isharis)

    This is actually not a problem directly related to the theme I am using but also happens on Twenty Twelve.

    Plugin Contributor photocrati

    (@photocrati)

    @muhammad – Thanks for that code sample but all variations including the original sample are sending all of my test sites into a 500 Server error.

    The exact shortcode you are using would be much better, perhaps a link to a https://gist.github.com/ or https://pastebin.com would work better?

    – Cais.

    Thread Starter Haris Zulfiqar

    (@isharis)

    Did you check your PHP error log to find out the issue? It might be a simple missing semi-colon or a copy/paste error at your own end which is causing 500 internal server error.

    Thread Starter Haris Zulfiqar

    (@isharis)

    Shortcode Gist: https://gist.github.com/mharis/140961b7e7e6171cba71
    Content to test within the a wordpress page (not page template): https://gist.github.com/mharis/6c5c4d20a46a0ddd6ff2

    Plugin Contributor photocrati

    (@photocrati)

    @muhammad – As I noted, I copied and pasted your exact code, as well as making various modifications and all produced the same results.

    – Cais.

    Thread Starter Haris Zulfiqar

    (@isharis)

    Thanks for double checking and all the help.

    Please, can you take a look at PHP error log as to why an internal server error shows up? I am not sure why it happens on your test sites as I am unable to replicate the same error locally.

    Plugin Contributor photocrati

    (@photocrati)

    @muhammad – There are no error_log entries from today … actually the last entry was from January 9, 2014.

    I did not expect to see the 500 Server error myself as I do not see anything wrong with your example code, but that does not change that it resulted in a 500 Server error all the same ??

    I even tried more unique function and shortcode names to no avail.

    Again, the actual shortcode code would still be more beneficial to see than this generic example.

    – Cais.

    Thread Starter Haris Zulfiqar

    (@isharis)

    Actual shortcode: https://gist.github.com/mharis/f0bc4b86993e996b27d4

    Then for the page content to test, you can use the following content:

    [recent_posts layout="default" columns="1" number_posts="4" cat_slug="" exclude_cats="" thumbnail="yes" title="yes" meta="yes" excerpt="yes" excerpt_words="35" strip_html="yes" animation_type="0" animation_direction="down" animation_speed="0.1"][/recent_posts]
    
    <img class="ngg_displayed_gallery mceItem" style="line-height: 1.5em;" alt="" src="https://avadatest.theme-fusion.com/nextgen-attach_to_post/preview/id--4687" />
    
    [ngg_images gallery_ids="1" exclusions="" display_type="photocrati-nextgen_basic_thumbnails" thumbnail_width="120" thumbnail_height="90"]

    For the gist code, the apply_filters is implemented under tf_content function.

    Plugin Contributor photocrati

    (@photocrati)

    @muhammad – Are you using the Avada theme? We have seen many issues with this particular theme and unfortunately they tend to be all over the place. The only thing I can suggest (at a glance) is to start by turning off the “Fusion Core” plugin (that is how it has been referenced, I have note seen the theme under the page).

    This may not be directly related to the issue you brought forward but I see some references in the gist that point to that theme.

    Also, that being the case, I think it may be best to bump this over to our Bug Reports (https://www.nextgen-gallery.com/report-bug/ … please reference this topic) so we can get a much better look at what might be going on with your site.

    Thanks!

    – Cais.

    Thread Starter Haris Zulfiqar

    (@isharis)

    Hi Cais,

    I am the developer of Avada theme and yes this is about theme. I do know there are compatibility issues but this is one it where the theme is not to be blamed but the issue can also be replicated on default theme where the_content filter is used.

    I’ll file a bug report.

    Thread Starter Haris Zulfiqar

    (@isharis)

    Hi Cais,

    I have submitted a bug report through the form that you linked to. Looking forward to get an update from your developers and in the meanwhile, I’ll go ahead and do some other pending work.

    Thanks for your help!

    Benjamin

    (@benjaminowens)

    I believe this is due to a bug in WordPress, see https://core.trac.www.ads-software.com/ticket/17817

    If you create a filter that triggers itself a second time any remaining actions will be ignored for the outter filter flow. The nextgen shortcode filter on the_content is given priority PHP_INT_MAX-1 however, so setting your own priority to PHP_INT_MAX will solve your incompatibility.

    Does anyone know if there is a sollution to this problem?
    I’ve been struggeling with this for a long time. If I use NGG shortcode together with any other shortcode that uses “the_content” filter, NGG shortcode fails to display the gallery.

    Example:
    I use “RPS Include Content plugin” to display the content of a post on a page.

    Shortcode example:[rps-include post=231 content=content filter=true]

    If I omit the “filter=true” attribute, I lose formatting. If I include it, NGG shortcode fails.

    Please someone help!

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘shortcodes fail after the_content filter’ is closed to new replies.