• Resolved juggernautical

    (@juggernautical)


    Any image to which a [caption] is added is failing to show at all on the front end; no image, no caption, no ghosted space.

    Blog post code:
    [caption align="aligncenter" width="450" caption="Cold Spring pea soup with parmesan ice cream"]<a href="https://www.rachelkhoo.com/eating-out/albion/attachment/img_1864" rel="attachment wp-att-4651"><img class="size-medium wp-image-4651" title="IMG_1864" src="https://www.rachelkhoo.com/wp-content/uploads/2012/06/IMG_1864-450x450.jpg" alt="" width="450" height="450" /></a>[/caption]

    What is showing in the editor:
    Screenshot

    What is showing on the front end:
    Live (Screenshot)

    …no images or captions ??

    This appears to be site-wide. Removing the caption short code results in the images re-appearing.

    I did not build this site, but am familiarising myself with it. Deactivating all plug-ins did not expose a culprit. This was an issue prior to updating to 3.4, and updating has not resolved it.

    Any of your thoughts would be much appreciated.

Viewing 11 replies - 1 through 11 (of 11 total)
  • Can you paste your php code for that front end page to the pastebin, please. It should probably be your theme’s index.php or single.php.

    Thread Starter juggernautical

    (@juggernautical)

    Thanks, s_ha_dum. Here’s the paste of single-with-sidebar.php, which I think is the one being used: https://pastebin.com/ZrCMmXfK

    the_content() should be processing the shortcodes. Add some text to that page, an html comment or something, so that you know for sure that that is the page.

    Do the shortcodes work if you switch to the default theme?

    Thread Starter juggernautical

    (@juggernautical)

    Added a HTML comment, and it’s the correct page, cheers for the tip.

    I’m uneasy about switching to default theme on the clients’ live site. Looks like I’m going to need to get this set up in a test environment to troubleshoot further.

    I’m going to need to get this set up in a test environment to troubleshoot further.

    Understandable.

    Thread Starter juggernautical

    (@juggernautical)

    I can confirm this is a theme issue, as switching to a default theme resulted in [caption] working properly again.

    Now just need to figure out what in this theme is causing the trouble.

    Anyone have any further suggestions on where to go from here?

    Look for add_filter or remove_filter in the theme’s source. The first place to look would be the theme’s functions.php but it could be loading functions from elsewhere.

    Thread Starter juggernautical

    (@juggernautical)

    Thanks once again, s_ha_dum, you’ve nailed it. I found this in functions.php:

    add_filter('the_content', 'remove_shortcode_from_index');

    Commenting it out has resulted in all the captioned images returning!

    I do not see any adverse effects on the front end from removing this (yet). I don’t suppose you have any idea what that filter’s purpose was?

    I’d guess the idea was to strip shortcodes from index listings. It makes sense in some contexts, but it wasn’t what you wanted. I doubt you’ll see any adverse effects.

    Thread Starter juggernautical

    (@juggernautical)

    Okay. Many thanks for you help!

    Ahhh, it looks like it was being used to stop the shortcodes from appearing in the blog excerpt. Now the captions are showing the in the blog except, sans images.

    You can see this happening in the post entitled ‘Albion’ on the blog: https://www.rachelkhoo.com/blog/
    I’m unsure how to restrict this function to the blog front page, rather than all pages.

    Thread Starter juggernautical

    (@juggernautical)

    Panic over. Using The Except feature as intended in the WP dashboard when creating the post as it is intended will circumvent this.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Use of caption shortcode results in blank space in blog posts’ is closed to new replies.