Video embeds work in backend, but are not parsed in frontend

I’ve just looked at the source of the WP_Embed class, and it appears they are not actually registering a shortcode, but hooking into the the_content filter. Change your code to $content_desktop = apply_filters(“the_content”, get_the_content()); or manually trigger their filter with something like $content_desktop = WP_Embed::run_shortcode(get_the_content()); or, if you prefer to have an object: $myembeds = … Read more

Need MySQL Query or WP-CLI command to updates old URLs in Shortcodes [closed]

You should try running WP-CLI’s search-replace command. $ wp search-replace ‘http://example.com’ ‘https://example.com’ –all-tables But you said these URLs are placed from a shortcode? Then you need to find out what this shortcode actually is doing. As it not necessarily has saved the URLs to the database. Maybe it’s a setting in the shortcode and then … Read more

How to call shortcode function directly and pass $atts

do_shortcode() just parses the string. You have to use echo or print to print it out. function_exists() expects a string that matches a function name. After looking at the plugin, I would try this code: <?php if ( function_exists( ‘mediacategories_func’ ) ) { ?> <h1>Inspiration</h1> <?php print mediacategories_func( array( ‘categories’ => 6 ) ); }

Shortcodes, HTML tables, and multiple rows

pass your data in single variables delimited by some char: [myproduct cols=”name,quantity,price” data=”name1,5,2.00,name2,3,3.25″] then explode it into an array and output. I didn’t bother with table markup here, but you get the idea: function myproduct_func( $atts ) { extract( shortcode_atts( array( ‘cols’ => ‘none’, ‘data’ => ‘none’, ), $atts ) ); $cols = explode(‘,’,$cols); $data … Read more

Adding Custom Fields for Img in Posts

You should use the post thumbnail feature. Add support for this feature with this line in your functions.php file: add_theme_support( ‘post-thumbnails’ ); You can also set a new thumbnail size that will be cropped on new added photos to use this in your theme. Add this code to set a new thumbnail size (also in … Read more

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)