Shortcode Attribute contains clone of all shortcode attributes
Shortcode Attribute contains clone of all shortcode attributes
Shortcode Attribute contains clone of all shortcode attributes
try adding quotes around the values returned by ACF: $thestore = get_field(‘store-name’); $theapp = get_field(‘app-id’); echo do_shortcode(‘[appbox “‘ . $thestore . ‘” “‘ . $theapp . ‘”]’);
Child theme are loaded first than parent theme. And unlike other template files functions.php of child theme get merged with parent theme’s functions.php instead of being overwritten. So a function i.e. et_pb_blog() declared in parent theme can not be re-declared in child theme. Solution: Remove the shortcode in child theme Add it again with child … Read more
Either make a regex filter as a the_content filter, add_filter(‘the_content’, ‘my_regex_filter’, 1); // Execute as early as possible function my_regex_filter($content) { $regex = get_shortcode_regex(array(‘showgallery’)); $content = preg_replace(“https://wordpress.stackexchange.com/”.$regex.’/s’, ‘[$1gallery$3$4$5$6]’, $content ); return $content; } or rewrite your add_shortcode function. remove_shortcode(‘showgallery’); add_shortcode(‘showgallery’, ‘my_showgallery’); function my_showgallery($args) { return gallery_shortcode($args); } I would recommend the second, because it is … Read more
Instead of use of shortcode, you can get the post content, format them the way you want and display them later. You can use get_the_content function; which will just retrieve post content in a variable. $raw_input = get_the_content(); /*process your content here and store the result in variable eg.*/ $raw_input = str_replace(“No”, “Yes”, $raw_input); print … Read more
function woo_products( $atts ) { global $post; $product_Out=””; $atts = shortcode_atts( array( ‘product_ids’ => ”,// your product id goes here ), $atts, ‘bartag’ ); $pro_ids = explode(“,”, $atts[‘product_ids’]); foreach ($pro_ids as $key => $values) { $product_obj = $product = wc_get_product( $values ); //call your html and data in $product out variable $product_Out .= ‘<div class=”product_name”>’.$values.'</div>’; … Read more
Image fix You are using the incorrect function to return the image source url. Change the_post_thumbnail_url( $post[“ID”] ) to get_the_post_thumbnail_url( $post[“ID”] ) see https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url/ To fix the echo Use a $return variable like so: $out=”<div class=”recent-posts”>”; $out .= ‘<h1>’.$content.'</h1>’; foreach($recent_posts as $post){ $out .= ‘<div class=”updated”><p>’ . $post[‘post_title’] . ‘.<a href=”‘ . get_permalink($post[‘ID’]) . ‘”>’; … Read more
It seems that I found a solution to this and it is pretty easy. So I’m gonna post all the code for future uses: single.php <?php get_header(); ?> <?php $post = get_post(); $post_cat = get_the_category($post); $data = collection_data_json($post_cat[0]->term_id, $post->ID); $data_details = collection_order_permalink($data); $author_id = intval($post->post_author); ?> <script type=”text/javascript”> var cat = “<?php print $post_cat_id ?>”; … Read more
I would call your use of shortcode nesting as a bad idea, therefor what you really need is a rethinking of your strategy. It is not bad by itself to nest shortcodes, but shortcodes should be independent entities and in your structure the inner ones will obviously depend on being “inner” and will not have … Read more
You are probably confused by the output of array_values() which will always get you only array values without keys while $atts variable is actually an associative array. To extract your attribute use $arr = $atts[‘tablepageid’]; Cheers