Display tags cloud from a specific category ID with a shortcode

I’ve finally found a working solution : function tag_cloud_shortcode($atts) { extract(shortcode_atts(array( ‘cat’ => ” ), $atts)); $query_args = array( ‘cat’ => $atts, ‘posts_per_page’ => -1 ); $custom_query = new WP_Query( $query_args ); if ($custom_query->have_posts()) : while ($custom_query->have_posts()) : $custom_query->the_post(); $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { $all_tags[] = $tag->term_id; } } endwhile; … Read more

Bootstrap carousel – Using shortcode inside enclosing shortcode

Here is my solution: function getProductCarousel($atts) { $productIds = explode(‘,’,$atts[‘product_ids’]); ?> <div class=”col-center m-auto”> <div id=”myCarousel” class=”carousel slide” data-ride=”carousel” data-interval=”0″> <!– Carousel indicators –> <ol class=”carousel-indicators”> <?php $slide = 0; ?> <?php foreach($productIds as $index => $productId) { ?> <?php if ($index % 3 == 0) { ?> <li data-target=”#myCarousel” data-slide-to=”<?= $slide++; ?>” <?= $index … Read more

Open/closed function [closed]

I’ve sourced the CSS from https://codepen.io/vram1980/pen/Kyaie all credit above. Putting it with your function, you can do something like this: add_shortcode( ‘linestatus’, ‘line_status_handler’ ); function line_status_handler( $atts ) { extract( shortcode_atts( array( ‘open_time’ => ’09:00:00′, ‘closed_time’ => ’17:00:00′, ‘open_text’ => ‘our lines are open’, ‘closed_text’ => ‘our lines are closed’, ), $atts ) ); $opened … Read more