• Resolved Jurjen

    (@jurjen)


    Hi there,

    It might be that I’m overcomplicating my code, but it seems that my WP site doesn’t know how to resolve the Colorbox shortcode.

    Since I have a multilingual site (using mqTranslate), I have to create several version and with a stubborn widget I had to embed everything write into the HTML/PHP codes.

    This is the result:
    <?php _e('[:en][wp_colorbox_media url="#contactbox" type="inline" hyperlink="Please use the contact form..."][:fr][wp_colorbox_media url="#contactbox" type="inline" hyperlink="S\'il vous pla?t utilisez le formulaire de contact..."][:nl][wp_colorbox_media url="#contactbox" type="inline" hyperlink="Gelieve het contactformulier gebruiken..."]'); ?>

    With a bit further on in the file (as shown in the example on your website:

    <div style="display:none">
    			<div id="contactbox" style"padding:10px; background:#fff;">
    				[cscf-contact-form]
    			</div>
    		</div>

    WordPress properly recognizes the language codes for mqTranslate and thuss only shows the shortcode that I’ve written for the specific language. However, it doesn’t resolve the Colorbox shortcode. It might very well be related to the plugin, which is why I’m posting the question here.

    Any ideas?

    Thanks!

    https://www.ads-software.com/plugins/wp-colorbox/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Noor Alam

    (@naa986)

    Hi, I have just released another update. You should be able to embed shortcode in a text widget now.

    Thread Starter Jurjen

    (@jurjen)

    Thanks for the quick reply and even plug-in update!

    However, the problem still exists.

    Thread Starter Jurjen

    (@jurjen)

    I tried all sorts of things:

    • I removed the language codes
    • I renamed the ID to avoid maybe using the same ID as another element
    • Used WP debug and FireFox element inspector

    Nothing fixes the problem.

    The code is inside the PHP file of my widget (not in an actual text field in the SQL database), which is inside the folder of the theme.

    As mentioned, it’s being outputted by php _e().

    Maybe that could indicate where the problem is?

    Plugin Author Noor Alam

    (@naa986)

    You might need to filter the shortcode through do_shortcode function since you are executing it in a php widget.

    https://codex.www.ads-software.com/Function_Reference/do_shortcode

    Thread Starter Jurjen

    (@jurjen)

    Indeed, the do_shortcode made it work in the end! Unfortunately the translations didn’t work any more after that.

    I ended up replacing your shortcode by the actual HTML code it should output to make it work with the translations: <a class="wp-colorbox-inline" href="#contactbox"><?php _e('translated texts'); ?></a>

    Not sure if you can improve this for future versions, but I just wanted to give you the feedback.

    And I’m glad you but me on this track since I needed the do_shortcode to make the shortcode work that I wanted to put inside the colorbox. ??

    Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Shortcode not resolving’ is closed to new replies.