Videos via the video shortcode are always 640px wide?

That width is dictated by the $content_width global, defined by the Theme. To change it, you’ll need to hook into after_setup_theme and modify it: function wpse124075_setup_theme() { global $content_width; if ( ! isset( $content_width ) ) { $content_width = 640; // your value here, in pixels } } add_action( ‘after_setup_theme’, ‘wpse124075_setup_theme’ );

How can I whitelist only specific shortcodes for processing in text widgets?

add_filter( ‘widget_text’, ‘wpse_137725_shortcode_whitelist’ ); /** * Apply only whitelisted shortcode to content. * * @link http://wordpress.stackexchange.com/q/137725/1685 * * @param string $text * @return string */ function wpse_137725_shortcode_whitelist( $text ) { static $whitelist = array( ‘gallery’, ‘form’, ); global $shortcode_tags; // Store original copy of registered tags. $_shortcode_tags = $shortcode_tags; // Remove any tags not in … Read more

shortcode_unautop shortcode not functioning

The above solution doesn’t work if you’re using Advanced Custom Fields. When using ACF, the following code does work: remove_filter( ‘the_content’, ‘wpautop’ ); remove_filter( ‘acf_the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘wpautop’ , 99); add_filter( ‘acf_the_content’, ‘wpautop’ , 100); add_filter( ‘the_content’, ‘shortcode_unautop’,110 ); add_filter( ‘acf_the_content’, ‘shortcode_unautop’,111 );

Stop strip_shortcodes() stripping content inside shortcodes

Try the filters in your functions.php: add_filter( ‘the_excerpt’, ‘shortcode_unautop’); add_filter( ‘the_excerpt’, ‘do_shortcode’); Props: @bainternet (Source) Or, use your own filter on get_the_excerpt. Put this in your theme’s functions.php: function custom_excerpt($text=””) { $raw_excerpt = $text; if ( ” == $text ) { $text = get_the_content(”); // $text = strip_shortcodes( $text ); $text = do_shortcode( $text ); … Read more

Multiple content areas per page

This sounds to me like a perfect use of Advanced Custom Fields “flexible content” feature to me. Flexible content fields allow you to define multiple layouts, and then add them to a page or post one by one, in any order or combination you need. Each layout can be a combination of text fields, images, … Read more

Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)

Why it is added in the footer: This is the expected behaviour. Since you have enqueued the style within your Shortcode hook function, by the time it executes, WordPress is already done generating the <head> section of your page, since WordPress will only execute your shortcode function once it has found the shortcode in your … Read more

shortcode for logo image

Change ‘name’ => ”, to ‘name’ => ‘logo’, Then when there is no name field passed to the shortcode, it will default to logo, which will load logo.png.

Loading shortcode with ajax

You cannot load a file directly like this: $(‘.homepage__slider’).load(‘wp-content/themes/mytheme/slider.php’); Also note that WordPress loads jQuery in noConflict mode, so the $ alias does not work. If you load a file directly none of the WordPress functions will work. You should be using the AJAX API so that everything loads in WordPress context. You would wrap … Read more

do_shortcode inside AJAX callback

The How It would be much better and easier if you’d just add the script directly to the main body instead of the AJAX call. The same goes with the shortcode result. Just use the shortcode as argument inside wp_localize_script(): wp_localize_script( ‘script-handle’, ‘pluginObject’, array( ‘contactForm’ => do_shortcode( ‘[contact-form-7 id=”698″ title=”Meet The Team Email”]’ ), ) … Read more