Variable inside shortcode or shortcode inside shortcode

apparently I found the solution (thanks to amatorpl), if anyone needs it: function show_history() { $user = wp_get_current_user(); $user_email = $user->user_email; $show_history = ‘[shortcode_name search=”‘.$user_email.'” show=”url, color, size”]’; $history = do_shortcode($show_history); return $history; } add_shortcode(‘show_history’, ‘show_history’); Thanks for the try

Problem parsing long parameter in shortcode

After tinkering obsessively, I have solved the problem. As stated above, this is the failing shortcode entered in the post [product product_sell_price=$765 product_description=20”x16” oil on stretched linen. Varnished for protection and ease of cleaning. Includes the frame as shown and is ready to hang.] This is the shortcode that works perfectly: [product product_sell_price=$765 product_description=’20”x16” oil … Read more

Shortcode for Custom Field of Media Attachment (to use with Featured Images)

The most basic option I can think of is this add_shortcode(‘bt_featured_image_acf_location’, ‘bt_featured_image_acf_location’); function bt_featured_image_acf_location ($atts) { return get_field(‘location’, get_post_thumbnail_id()); } Change ‘location’ to your acf field name and thats it. get_post_thumbnail_id() will get the current post featured image id. Once you have the ID of the post (images are posts, they are of the post … Read more

How to pass parameters in wordpress shortcode?

As the docs for add_shortcode() state, Every shortcode callback is passed three parameters by default, including an array of attributes ($atts), the shortcode content or null if not set ($content), and finally the shortcode tag itself ($shortcode_tag), in that order. Use the shortcode_atts() to define what attributes are allowed and set default values for those … Read more