Adding shortcode inside Visual Composer raw HTML [closed]

When you look at how do_shortcode() actually works, then it’s this: do_shortcode( $content ) Where $content is defined as the following: (string) Content to search for shortcodes What you are trying to do is to echo what the shortcode does, leading to a false assumption. There is no magic function discovering your shortcode. The shortcode … Read more

How to display some selected user meta data on a specific page with a shortcode?

Here is the simplest shortcode that will do the job for you add_shortcode(‘USER_META’, ‘user_meta_shortcode_handler’); /** * User Meta Shortcode handler * usage: [USER_META user_id=1 meta=”first_name”] * @param array $atts * @param string $content * @return stirng */ function user_meta_shortcode_handler($atts,$content=null){ return esc_html(get_user_meta($atts[‘user_id’], $atts[‘meta’], true)); } USAGE: [USER_META user_id=1 meta=”first_name”] [USER_META user_id=1 meta=”last_name”]

Execute shortcode only in another shortcode

To use a different callback for the nested headings switch the shortcode handler in the pricing_box callback and restore the main handler before you return the string. add_shortcode( ‘pricing_box’, ‘shortcode_pricing_box’ ); add_shortcode( ‘heading’, ‘shortcode_heading_main’ ); function shortcode_pricing_box( $atts, $content=”” ) { // switch shortcode handlers add_shortcode( ‘heading’, ‘shortcode_heading_pricing_box’ ); $out=”<div class=”pricing-box”>” . do_shortcode( $content ) … Read more

Why do_shortcode is not executing the shortcode in data-* html attributes?

do_shortcodes_in_html_tags() runs attributes through wp_kses_one_attr() which checks them against wp_kses_allowed_html( ‘post’ ) which by default only accepts standard non-data attributes, so you’d have to add your attribute: add_filter( ‘wp_kses_allowed_html’, function ( $allowedposttags, $context ) { if ( $context == ‘post’ ) { $allowedposttags[‘a’][‘data-abc’] = 1; } return $allowedposttags; }, 10, 2 );

How do I create shortcodes for my wordpress themes?

See the Shortcode API article on the Codex for a tutorial and my Shortcode Plugin for some examples. A very basic example for the functions.php: /** * Shortcode for bloginfo() * * Usage: [bloginfo key=”template_url”] * * @see http://codex.wordpress.org/Template_Tags/get_bloginfo * @source http://blue-anvil.com/archives/8-fun-useful-shortcode-functions-for-wordpress * @param array $atts * @return string */ function bloginfo_shortcode($atts) { extract( shortcode_atts( … Read more

Using shortcodes in PHP

Referering to the Shortcodes API you can do echo do_shortcode(‘[helloworld]’); if your shortcode not in post. Or you can do echo apply_filters(‘the_content’, ‘[helloworld]’); but this will also bring other filters to work on your shorcode return html.

How to render complicated shortcodes

Good to hear that you managed to solve the problem already. Here’s a few examples on how you could also return html from a shortcode. As you already found out, you can use ob_start() and ob_get_clean() to buffer the html. Inside it you can echo the markup or drop out of PHP and write plain … Read more

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