Shortcode not working inside html input

As above, https://wordpress.stackexchange.com/a/195673/22728 solved it: add_filter( ‘wp_kses_allowed_html’, function ( $allowedposttags, $context ) { if ( $context == ‘post’ ) { $allowedposttags[‘input’][‘value’] = 1; } return $allowedposttags; }, 10, 2 );

Localize variable for multiple Shortcodes

Your ploblem is that wp_localize_script print to the html markup a javascript object similar to: var slider = {“id”:”a_unique_id_here”}; if you call it more times, e.g. using more shortcodes in same page, whati is printend in html markup is var slider = {“id”:”a_unique_id_here”}; var slider = {“id”:”another_unique_id_here”}; var slider = {“id”:”third_unique_id_here”}; so you are overwriting … Read more

How to create a shortcode to display a category description?

Try this. Add the code below to your functions.php file – add_shortcode(‘cat_description’, ‘my_cat_description_shortcode’); function my_cat_description_shortcode($atts){ $a = shortcode_atts( array( ‘id’ => 0, ), $atts ); return category_description($a[‘id’]); } Should you wish to call the shortcode from a template (unnecessary really unless you add more to the shortcode) you can use this code – <?php echo … Read more

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”]

append stylesheet via shortcode

here is a handy function i use a lot which is based on the_posts hook function check_for_shortcode($posts) { if ( empty($posts) ) return $posts; $flag = false; foreach ($posts as $post) { if ( stripos($post->post_content, ‘[YOUR_SHORTCODE_HERE’) ) $flag = true; break; } if ($flag){ //add scripts and styles here eg: //wp_enqueue_script //wp_enqueue_style } return $posts; … Read more

Shortcodes not resolved in AJAX call response

Since version 4.9 visual composer added shortcode lazy loading. To use VC shortcodes on AJAX content use this function before printing the content WPBMap::addAllMappedShortcodes();. So below code may help you, function get_page_content(){ $id = $_REQUEST[‘id’]; $page_data = get_page($id); WPBMap::addAllMappedShortcodes(); echo apply_filters(‘the_content’, $page_data->post_content); wp_die(); } add_action( ‘wp_ajax_nopriv_get_page_content’, ‘get_page_content’ ); add_action( ‘wp_ajax_get_page_content’, ‘get_page_content’ );

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