Display shortcode in text field with wordpress settings api

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

SQL query to bulk change short code in all posts

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

PHP not outputting the onclick in anchor tag

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 });

How to use strip_shortcodes() from a spawned process?

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 );

create a shortcode with acf including a filter

This is not the full working code, just to illustrate how to add the shortcode and trigger the function. <?php // Check if ACF is available if(function_exists(‘get_field’)) { function modell_nach_personenzahl_variabel() { $args = array( ‘post_type’ => ‘womos’, ‘order’ => ‘ASC’, ‘orderby’ => ‘personen’, ‘field’ => $atts[‘personen’], ‘numberposts’ => -1, ‘meta_query’ => array ( array ( … Read more

Print shortcode according to site language

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

Display Custom Post Type Archive content with Shortcode

Most probably you need a bunch of divs etc duplicated in both archive-custom.php and the shortcode. Identify those divs, and move them into a new template file in your theme, e.g. in part-archive-custom.php. Then, delete them from archive-custom.php and add a call to get_template_part(‘part-archive-custom’); instead. Do the same inside your shortcode.