Multiple values for one variable
Multiple values for one variable
Multiple values for one variable
Use a shortcode with parameters function oosdfw_title_display($atts) { $a = shortcode_atts( array( ‘before’ => ‘Sorry, ‘, ‘after’ => ‘ has sold out.’, ), $atts ); return $a[‘before’].get_the_title().$a[‘after’]; } add_shortcode( ‘oosd-title’, ‘oosdfw_title_display’ ); Put shortcode in text field and modify before and after parameters to suit your requirements. [oosd-title before=”Sorry ” after = ” has sold … Read more
As Birgire mentioned in the comments, you can hook into the gallery output rather than performing a search/replace on the database. From the WordPress Codex: Function Reference/shortcode atts gallery Provides the ability to filter the array returned from shortcode_atts(). You want something like this: add_filter( ‘shortcode_atts_gallery’, ‘gallery_shortcode_exclude_thumbnail’, 10, 3 ); function gallery_shortcode_exclude_thumbnail( $result, $defaults, $atts … Read more
WordPress 5.1 and Syntax highlighter, problem with HTML encoded special characters
I think WP is stripping the onclick out of the content. You shouldn’t really use inline onclick anyway. Give the link an ID and then add an on click in your JS. Something like this… jQuery(‘#myLink’).click(function() { … Your myFunction() code });
You can manually add shortcodes to the array of tags to be stripped in strip_shortcodes() via filter. If the global $shortcode_tags either doesn’t exist or doesn’t contain what it should when your process is running then you’ll need to use that filter to add them back in. $tags_to_remove = apply_filters( ‘strip_shortcodes_tagnames’, $tags_to_remove, $content );
wp_link_pages() by default echoes the links (or the output), unless you set the echo parameter to 0 (or false). Secondly, your code is returning an array with nextpagelink as the only item/value. But anyway, if you just want the link to the next page, the wp_link_pages() wouldn’t be the one you should be using since … Read more
That’s probably basic PHP. As all that’s needed would be some kind of map/array and then switch use the id according to what get_locale() returns. <?php // Provide a map if locales and shortcode IDs. $custom_footer = [ ‘ar’ => ‘319’, ‘en_US’ => ‘3181’, // … and so on ]; // Get the current language. … Read more
Since my post meta data was holding this data even upon refresh, all I had to do was delete this metakey once all the shortcodes on my post content were processed. For that, I made another shortcode and invoked that with do_shortcode() on single.php since that only processes once at the end. Now once I … Read more
Indeed, if you allow all kinds of shortcodes to be used in comments, you do not know what effects you get. It might even become a security issue if you have powerful shortcodes installed (perhaps even without knowing it, as a feature you do not use). So, the trick is to selectively allow certain shortcodes. … Read more