Spiraclethemes Site Library Shortcodes

Below, you’ll find a detailed guide on how to add the Spiraclethemes Site Library Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Spiraclethemes Site Library Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Spiraclethemes Site Library Plugin and the shortcodes it provides:

Plugin Icon
Spiraclethemes Site Library

"Spiraclethemes Site Library is a WordPress plugin that provides a vast collection of pre-designed website themes. It allows users to choose and import their preferred theme effortlessly."

✩✩✩✩✩ () Active Installs: 2000+ Tested with: 6.2.3 PHP Version: 5.6
Included Shortcodes:
  • [gridposts]
  • [listprod]
  • [featuredprod]
  • [newprod]
  • [popularprod]
  • [recentblog]

Spiraclethemes Site Library [gridposts] Shortcode

The Spiraclethemes Site Library shortcode, `gridposts`, is a powerful tool for displaying blog posts in a grid format. It allows customization of post attributes such as title, author, date, comments, and more. It also provides flexibility with post ordering and categorization. This shortcode is particularly useful for creating visually appealing blog sections on your WordPress site.

Shortcode: [gridposts]

Parameters

Here is a list of all possible gridposts shortcode parameters and attributes:

  • show_section_title – displays the section title if set to ‘true’
  • section_title – sets the title of the section
  • section_title_size – defines the size of the section title
  • post_count – determines the number of posts to display
  • post_columns – sets the layout of the posts in columns
  • post_style – determines the style of the posts
  • post_orderby – sets the order of posts by date, title, etc
  • post_order – defines the ascending or descending order of posts
  • post_cat_slug – filters posts based on the category slug
  • post_ids – displays posts based on specific post IDs
  • post__not_in – excludes posts based on specific post IDs
  • post_thumbsize – adjusts the size of the post thumbnail
  • post_content_show – shows post content if set to ‘true’
  • post_excerpt_count – limits the number of words in the post excerpt
  • post_display_categories – shows post categories if set to ‘true’
  • post_display_date – shows post date if set to ‘true’
  • post_display_author – shows post author if set to ‘true’
  • post_display_author_pre_text – displays text before the author’s name
  • post_display_comments – shows post comments if set to ‘true’
  • post_show_readmore – displays ‘Read More’ link if set to ‘true’
  • post_readmore_text – sets the text for the ‘Read More’ link
  • post_ignore_featured – ignores featured posts if set to ‘true’
  • post_trim_title – trims the post title if set to ‘true’
  • post_trim_title_count – limits the number of words in the post title
  • post_text_position – sets the position of the post text

Examples and Usage

Basic example – Display posts in a grid format

[gridposts]

By using the ‘gridposts’ shortcode, you can display posts in a grid format on any page or post. This shortcode uses the default settings from the spiraclethemes_site_library_blogson_gridposts function.

Advanced examples

Display posts from a specific category in a grid format

[gridposts post_cat_slug="wordpress-tips"]

With the ‘post_cat_slug’ parameter, you can specify which category of posts you want to display in the grid. In this example, it will display posts from the ‘wordpress-tips’ category.

Show only specific posts in a grid format

[gridposts post_ids="1,2,3"]

The ‘post_ids’ parameter allows you to specify which posts to display in the grid by their IDs. In this example, it will display posts with the IDs 1, 2, and 3.

Show posts in a grid format and exclude specific posts

[gridposts post__not_in="4,5,6"]

The ‘post__not_in’ parameter allows you to exclude specific posts from the grid by their IDs. In this example, it excludes posts with the IDs 4, 5, and 6 from the grid.

PHP Function Code

In case you have difficulties debugging what causing issues with [gridposts] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('gridposts', 'spiraclethemes_site_library_blogson_gridposts');

Shortcode PHP function:

function spiraclethemes_site_library_blogson_gridposts($atts, $content = null) {
        extract(shortcode_atts(array(
            'show_section_title' => 'true',
            'section_title' => '',
            'section_title_size' => 'h2',
            'post_count' => '4',
            'post_columns' => 'span6',
            'post_style' => 'style_1',
            'post_orderby' => 'date',
            'post_order' => 'DESC',
            'post_cat_slug' => '',
            'post_ids' => '',
            'post__not_in' => '',
            'post_thumbsize'     => 'post-thumbnail',
            'post_content_show' => 'true',
            'post_excerpt_count' => '15',
            'post_display_categories' => 'true',
            'post_display_date' => 'true',
            'post_display_author' => 'true',
            'post_display_author_pre_text' => 'By',
            'post_display_comments' => 'true',
            'post_show_readmore' => 'false',
            'post_readmore_text' => 'Read More',
            'post_ignore_featured' => 'true',
            'post_trim_title' => 'true',
            'post_trim_title_count' => '7',
            'post_text_position' => 'bottomcenter'
        ), $atts));

        global $post;
        global $paged;
        if ( is_front_page() ) {
            $paged = (get_query_var('page')) ? get_query_var('page') : 1;
        } else {
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
        }
        if($post_ids != ''){
            $post_ids = str_replace(' ', '', $post_ids);
            if (strpos($post_ids, ',') !== false){
                $post_ids = explode(',', $post_ids);
            } else {
                $post_ids = array($post_ids);
            }
        } else {
            $post_ids = array();
        }
        if($post__not_in != ''){
            $post__not_in = str_replace(' ', '', $post__not_in);
            if (strpos($post__not_in, ',') !== false){
                $post__not_in = explode(',', $post__not_in);
            } else {
                $post__not_in = array($post__not_in);
            }
        } else {
            $post__not_in = array();
        }

        $show_section_title = ($show_section_title === 'true' || $show_section_title=='1');
        $post_display_comments = ($post_display_comments === 'true' || $post_display_comments=='1');
        $post_display_date = ($post_display_date == 'true' || $post_display_date=='1');
        $post_display_author = ($post_display_author == 'true' || $post_display_author=='1');
        $post_display_categories = ($post_display_categories === 'true' || $post_display_categories=='1');
        $post_ignore_featured = ($post_ignore_featured === 'true' || $post_ignore_featured=='1' );
        $post_content_show = ($post_content_show === 'true' || $post_content_show == '1' );
        $post_show_readmore = ($post_show_readmore === 'true' || $post_show_readmore == '1' );
        $bottom_lines = '';
        $contentoverimage='';
        $ignorestickyposts='';
       
        if($post_style=== 'style_1' || $post_style=== 'style_2') {
            $contentoverimage="contentoverimage";
        }
        else{
            $contentoverimage="nocontentoverimage";
        }

        $sticky_args = [
            'post__in' => get_option('sticky_posts'),
            'post_status' => 'publish'
        ];
        $sticky_posts = new WP_Query($sticky_args);
        $sticky_count = $sticky_posts->post_count; 
        
        if($post_style=='style_1' && $post_cat_slug == '' && $sticky_count > 0){
            $post_count=3 - $sticky_count;
            $post_columns='span4f';
        }
        elseif($post_style=='style_1'){
            $post_count=3;
           $post_columns='span4f';
        }


        $args = array(
            'post_type' => 'post',
            'posts_per_page' => $post_count,
            'post__in' => $post_ids,
            'post__not_in' => $post__not_in,
            'order'          => $post_order,
            'orderby'        => $post_orderby,
            'post_status'    => 'publish',
        );
        if($post_cat_slug != '' && $post_cat_slug != 'all'){
            $str = str_replace(' ', '', $post_cat_slug);
            $arr = explode(',', $str);    
            $args['tax_query'][] = array(
              'taxonomy'  => 'category',
              'field'   => 'slug',
              'terms'   => $arr
            );

        }
        
        static $post_section_id = 0;
        $out = '';
        ++$post_section_id;
        query_posts( $args );
        
        if( have_posts() ) {
            $out .= '<div class="latest-posts">';
            if( $section_title != '' && $show_section_title==true ) {
                $out .= '<'.$section_title_size.' class="post_title">'.esc_html($section_title).'</'.$section_title_size.'>';
            }
            $out .= '<div id="blog-posts-'.$post_section_id.'" class="row-fluid blog-posts">';
            
            if($post_style=='style_1') {
                while ( have_posts() ) {
                    the_post();
                    $classes = join(' ', get_post_class($post->ID) );
                    $classes .= ' post';
                    if(true) {
                        $classes = str_replace('sticky ', '', $classes);
                        $out .= '<article class="textcenter '.$classes.' '.$contentoverimage.' '.$post_columns.' '.$post_style.' '.$post_text_position.' ">';
                            
                        if(has_post_thumbnail()) { 
                            $post_img_url= wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $post_thumbsize );
                        }
                        else {
                            $post_img_url[0] =  esc_url( plugins_url( 'img/no-image.jpg', dirname(__FILE__) ) );
                        }

                        $out .= '<div id="post-'.$post->ID.'" class="post-grid-area-box">';
                            $out .= '<div class="post-grid-area-content" style="background:url('.$post_img_url[0].') no-repeat;">';
                                $out .= '<div class="content-wrapper">';
                                    $out .= '<div class="content">';
                                        $out .= '<div class="content-inner">';
                                            $out .= '<div class="category">';
                                                if( $post_display_categories ) 
                                                $out .= '<span> '.get_the_category_list(', ').' </span>';
                                            $out .= '</div>';
                                            $out .= '<div class="title">';
                                                if($post_trim_title=='true') {
                                                    $out .= '<h2><a href="'.get_the_permalink().'" title="'.esc_html__('Permalink to', 'spiraclethemes-site-library').' '.esc_attr(the_title_attribute('echo=0')).'" rel="bookmark">'. wp_trim_words(get_the_title(), $post_trim_title_count).'</a></h2>';
                                                }
                                                else {
                                                    $out .= '<h2><a href="'.get_the_permalink().'" title="'.esc_html__('Permalink to', 'spiraclethemes-site-library').' '.esc_attr(the_title_attribute('echo=0')).'" rel="bookmark">'. get_the_title() .'</a></h2>';
                                                }
                                            $out .= '</div>';
                                            $out .= '<div class="meta">';
                                                if( $post_display_author ) {
                                                    $out .= '<span class="author"><span>'. esc_html( $post_display_author_pre_text ) .':&nbsp;<a class="author-post-url" href="'. esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) .'">'. get_the_author() .'</a></span></span>';
                                                }
                                                if( $post_display_date ) {
                                                    $out .= '<span class="date"><span>' .get_the_time(get_option('date_format')). '</span></span>';
                                                }
                                                if( $post_display_comments ) {
                                                    $out .= '<span class="comments"><span><a class="post-comments-url" href="'. get_the_permalink().'#comments" >'. get_comments_number('0','1','%') . esc_html__(" Comments","blogson") .'</a></span></span>';
                                                }
                                            $out .= '</div>';

                                        $out .= '</div>';
                                    $out .= '</div>';
                                $out .= '</div>';
                            $out .= '</div>';   
                        $out .= '</div>';
                       
                        $out .= '</article>';
                    }

                }

            }
            if($post_style=='style_2') {
                while ( have_posts() ) {
                    the_post();
                    $classes = join(' ', get_post_class($post->ID) );
                    $classes .= ' post';
                    if(true) {
                        $classes = str_replace('sticky ', '', $classes);
                        $out .= '<article class="textcenter '.$classes.' '.$contentoverimage.' '.$post_columns.' '.$post_style.' '.$post_text_position.' ">';
                            
                        if(has_post_thumbnail()) { 
                            $post_img_url= wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $post_thumbsize );
                        }
                        else {
                            $post_img_url[0] =  esc_url( plugins_url( 'img/no-image.jpg', dirname(__FILE__) ) );
                        }
                        $out .= '<div id="post-'.$post->ID.'" class="post-grid-area-box">';
                            $out .= '<div class="post-grid-area-content" style="background:url('.$post_img_url[0].') no-repeat;">';
                                $out .= '<div class="content-wrapper">';
                                    $out .= '<div class="content">';
                                        $out .= '<div class="content-inner">';
                                            $out .= '<div class="category">';
                                                if( $post_display_categories ) 
                                                $out .= '<span> '.get_the_category_list(', ').' </span>';
                                            $out .= '</div>';
                                            $out .= '<div class="title">';
                                                if($post_trim_title=='true') {
                                                    $out .= '<h2><a href="'.get_the_permalink().'" title="'.esc_html__('Permalink to', 'spiraclethemes-site-library').' '.esc_attr(the_title_attribute('echo=0')).'" rel="bookmark">'. wp_trim_words(get_the_title(), $post_trim_title_count).'</a></h2>';
                                                }
                                                else {
                                                    $out .= '<h2><a href="'.get_the_permalink().'" title="'.esc_html__('Permalink to', 'spiraclethemes-site-library').' '.esc_attr(the_title_attribute('echo=0')).'" rel="bookmark">'. get_the_title() .'</a></h2>';
                                                }
                                            $out .= '</div>';
                                            $out .= '<div class="meta">';
                                                if( $post_display_author ) {
                                                    $out .= '<span class="author"><span>'. esc_html( $post_display_author_pre_text ) .':&nbsp;<a class="author-post-url" href="'. esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) .'">'. get_the_author() .'</a></span></span>';
                                                }
                                                if( $post_display_date ) {
                                                    $out .= '<span class="date"><span>' .get_the_time(get_option('date_format')). '</span></span>';
                                                }
                                                if( $post_display_comments ) {
                                                    $out .= '<span class="comments"><span><a class="post-comments-url" href="'. get_the_permalink().'#comments" >'. get_comments_number('0','1','%') . esc_html__(" Comments","blogson") .'</a></span></span>';
                                                }
                                            $out .= '</div>';

                                        $out .= '</div>';
                                    $out .= '</div>';
                                $out .= '</div>';
                            $out .= '</div>';   
                        $out .= '</div>';
                        $out .= '</article>';
                    }

                }
            }
            if($post_style=='style_3') {
                while ( have_posts() ) {
                    the_post();
                    $classes = join(' ', get_post_class($post->ID) );
                    $classes .= ' post';
                    if(true) {
                        $classes = str_replace('sticky ', '', $classes);
                        $out .= '<article class="textcenter '.$classes.' '.$contentoverimage.' '.$post_columns.' '.$post_style.' '.$post_text_position.' ">';
                            
                        if(has_post_thumbnail()) { 
                            $post_img_url= wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $post_thumbsize );
                        }
                        else {
                            $post_img_url[0] =  esc_url( plugins_url( 'img/no-image.jpg', dirname(__FILE__) ) );
                        }
                        $out .= '<div id="post-'.$post->ID.'" class="post-grid-area-box">';
                            $out .= '<div class="post-grid">';
                                $out .= '<div class="content-wrapper">';
                                    $out .= '<div class="post-image">';
                                        $out .= '<div class="post-image-wrapper">';
                                            $out .= '<img src="'.esc_url($post_img_url[0]).'" />';
                                        $out .= '</div>';
                                    $out .= '</div>';
                                    $out .= '<div class="content">';
                                        $out .= '<div class="content-inner">';
                                            $out .= '<div class="category">';
                                                if( $post_display_categories ) 
                                                $out .= '<span> '.get_the_category_list(', ').' </span>';
                                            $out .= '</div>';
                                            $out .= '<div class="title">';
                                                if($post_trim_title=='true') {
                                                    $out .= '<h2><a href="'.get_the_permalink().'" title="'.esc_html__('Permalink to', 'spiraclethemes-site-library').' '.esc_attr(the_title_attribute('echo=0')).'" rel="bookmark">'. wp_trim_words(get_the_title(), $post_trim_title_count).'</a></h2>';
                                                }
                                                else {
                                                    $out .= '<h2><a href="'.get_the_permalink().'" title="'.esc_html__('Permalink to', 'spiraclethemes-site-library').' '.esc_attr(the_title_attribute('echo=0')).'" rel="bookmark">'. get_the_title() .'</a></h2>';
                                                }
                                            $out .= '</div>';
                                            $out .= '<div class="meta">';
                                                if( $post_display_author ) {
                                                    $out .= '<span class="author"><span>'. esc_html( $post_display_author_pre_text ) .':&nbsp;<a class="author-post-url" href="'. esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) .'">'. get_the_author() .'</a></span></span>';
                                                }
                                                if( $post_display_date ) {
                                                    $out .= '<span class="date"><span>' .get_the_time(get_option('date_format')). '</span></span>';
                                                }
                                                if( $post_display_comments ) {
                                                    $out .= '<span class="comments"><span><a class="post-comments-url" href="'. get_the_permalink().'#comments" >'. get_comments_number('0','1','%') . esc_html__(" Comments","blogson") .'</a></span></span>';
                                                }
                                            $out .= '</div>';
                                            if( $post_content_show ) {
                                                $out .= '<div class="main-content">';
                                                    $out .= '<p class="post-content">'. wp_trim_words(get_the_content(), $post_excerpt_count).'</p>';
                                                $out .= '</div>';
                                            }
                                            if( $post_show_readmore ) {
                                                $out .= '<div class="post-read-more">';
                                                $out .= '<a href="'.get_the_permalink().'">'. esc_html($post_readmore_text).'</a>';
                                                $out .= '</div>';
                                            }
                                        $out .= '</div>';
                                    $out .= '</div>';
                                $out .= '</div>';
                            $out .= '</div>';   
                        $out .= '</div>';
                        $out .= '</article>';
                    }

                }
            }
    
            $out .= '</div>';
           
            $out .= '</div>';
        }
        wp_reset_query();
        return $out;
    }

Code file location:

spiraclethemes-site-library/spiraclethemes-site-library/inc/blogson-functions.php

Spiraclethemes Site Library [listprod] Shortcode

The SpiracleThemes Site Library shortcode ‘listprod’ is designed to list products on your WordPress website. It allows you to customize the product display, including the number of products and columns, and whether to display product tabs. The shortcode takes parameters for product options, product count, product columns count, and product display tabs. It then generates a product list according to these parameters, with options to display all products, featured products, new products, or popular products. Shortcode: [listprod prod_options=”all,featured,new,popular” prod_count=”8″ prod_columns_count=”4″ prod_display_tabs=”true”]

Shortcode: [listprod]

Parameters

Here is a list of all possible listprod shortcode parameters and attributes:

  • prod_options – specifies the type of products to display (all, featured, new, popular)
  • prod_count – defines the number of products to show
  • prod_columns_count – sets the number of columns for displaying products
  • prod_display_tabs – decides if product tabs should be shown or not

Examples and Usage

Basic example – The following shortcode displays a list of products without any specific options. It uses the default values for product count and column count, and it displays tabs.

[listprod /]

Advanced examples

Displaying a list of ‘featured’ and ‘new’ products, with a product count of 12 and 3 columns, and without displaying tabs:

[listprod prod_options="featured,new" prod_count="12" prod_columns_count="3" prod_display_tabs="false" /]

Displaying a list of ‘all’ and ‘popular’ products, with a product count of 10 and 4 columns, and displaying tabs:

[listprod prod_options="all,popular" prod_count="10" prod_columns_count="4" prod_display_tabs="true" /]

Displaying a list of ‘new’ products only, with a product count of 6 and 2 columns, and without displaying tabs:

[listprod prod_options="new" prod_count="6" prod_columns_count="2" prod_display_tabs="false" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [listprod] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('listprod', 'spiraclethemes_site_library_own_shop_listprod');

Shortcode PHP function:

function spiraclethemes_site_library_own_shop_listprod($atts, $content = null) {
        extract(shortcode_atts(array(
            'prod_options' => '',
            'prod_count' => '8',
            'prod_columns_count' => '4',
            'prod_display_tabs' => 'true'
        ), $atts));

       
        $prod_display_tabs = ($prod_display_tabs === 'true' || $prod_display_tabs=='1');
        $arr='';
        if($prod_options != '' && $prod_options != 'all') {
            $str = str_replace(' ', '', $prod_options);
            $arr = explode(',', $str);
        }
        
        ?>
            <div class="list-products-section">
                <div class="tabbable-panel">
                    <div class="tabbable-line">
                        <?php
                            if( true==$prod_display_tabs ) :
                                ?>
                                    <ul class="nav nav-tabs ">
                                        <?php
                                            $tabcount=0;
                                            if (in_array("all", $arr)) :
                                                $tabcount++;
                                                if($tabcount==1) :
                                                    ?><li class="active"><?php
                                                else :
                                                    ?><li><?php
                                                endif;
                                                ?><a href="#tab_default_<?php echo $tabcount; ?>" data-toggle="tab"><?php echo esc_html_e('All','spiraclethemes-site-library'); ?></a></li><?php
                                            endif;
                                            if (in_array("featured", $arr)) :
                                                $tabcount++;
                                                if($tabcount==1) :
                                                    ?><li class="active"><?php
                                                else :
                                                    ?><li><?php
                                                endif;
                                                ?><a href="#tab_default_<?php echo $tabcount; ?>" data-toggle="tab"><?php echo esc_html_e('Featured','spiraclethemes-site-library'); ?></a></li><?php
                                            endif;
                                            if (in_array("new", $arr)) :
                                                $tabcount++;
                                                if($tabcount==1) :
                                                    ?><li class="active"><?php
                                                else :
                                                    ?><li><?php
                                                endif;
                                                ?><a href="#tab_default_<?php echo $tabcount; ?>" data-toggle="tab"><?php echo esc_html_e('New','spiraclethemes-site-library'); ?></a></li><?php
                                            endif;
                                            if (in_array("popular", $arr)) :
                                                $tabcount++;
                                                if($tabcount==1) :
                                                    ?><li class="active"><?php
                                                else :
                                                    ?><li><?php
                                                endif;
                                                ?><a href="#tab_default_<?php echo $tabcount; ?>" data-toggle="tab"><?php echo esc_html_e('Popular','spiraclethemes-site-library'); ?></a></li><?php
                                            endif;
                                        ?>
                                    </ul>
                                <?php
                            endif;
                        ?>
                        <div class="tab-content">
                            <?php
                                $tabcount=0;
                                if (in_array("all", $arr)) :
                                    $tabcount++;
                                    if($tabcount==1) :
                                        ?><div class="tab-pane active" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    else :
                                        ?><div class="tab-pane" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    endif;
                                    ?>
                                        <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'"]'); ?>
                                        </div>
                                    <?php
                                endif;
                                if (in_array("featured", $arr)) :
                                    $tabcount++;
                                    if($tabcount==1) :
                                        ?><div class="tab-pane active" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    else :
                                        ?><div class="tab-pane" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    endif;
                                    ?>
                                        <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'" visibility="featured"]'); ?>
                                        </div>
                                    <?php
                                endif;
                                if (in_array("new", $arr)) :
                                    $tabcount++;
                                    if($tabcount==1) :
                                        ?><div class="tab-pane active" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    else :
                                        ?><div class="tab-pane" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    endif;
                                    ?>
                                        <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'" orderby="id" order="DESC" visibility="visible"]'); ?>
                                        </div>
                                    <?php
                                endif;
                                if (in_array("popular", $arr)) :
                                    $tabcount++;
                                    if($tabcount==1) :
                                        ?><div class="tab-pane active" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    else :
                                        ?><div class="tab-pane" id="tab_default_<?php echo $tabcount; ?>"><?php
                                    endif;
                                    ?>	
                                        <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'" best_selling="true" ]'); ?>
                                        </div>
                                    <?php
                                endif;
                            ?>
                        </div>
                    </div>
                </div>
            </div>
        <?php
      
    }

Code file location:

spiraclethemes-site-library/spiraclethemes-site-library/inc/own-shop-functions.php

Spiraclethemes Site Library [featuredprod] Shortcode

The SpiracleThemes Site Library shortcode is a customizable feature that displays a set number of featured products from your shop. The ‘prod_count’ and ‘prod_columns_count’ attributes allow you to control the number of products displayed and their arrangement.

Shortcode: [featuredprod]

Parameters

Here is a list of all possible featuredprod shortcode parameters and attributes:

  • prod_count – Defines the number of featured products to display.
  • prod_columns_count – Determines the number of columns in the product grid.

Examples and Usage

Basic example – Displaying the default number of featured products in a grid layout.

[featuredprod /]

Advanced examples

Displaying a custom number of featured products.

[featuredprod prod_count=5 /]

Setting a custom number of columns for the featured products grid.

[featuredprod prod_columns_count=3 /]

Displaying a custom number of featured products in a custom number of columns.

[featuredprod prod_count=5 prod_columns_count=3 /]

These shortcodes allow you to control the display of featured products on your WordPress site. By adjusting the parameters, you can tailor the layout to fit your site’s design and your audience’s needs.

PHP Function Code

In case you have difficulties debugging what causing issues with [featuredprod] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('featuredprod', 'spiraclethemes_site_library_own_shop_featuredprod');

Shortcode PHP function:

function spiraclethemes_site_library_own_shop_featuredprod($atts, $content = null) {
        extract(shortcode_atts(array(
            'prod_count' => '8',
            'prod_columns_count' => '4',
        ), $atts));
        
        ?>
            <div class="list-products-section">
                <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'" visibility="featured"]'); ?>
            </div>
        <?php
      
    }

Code file location:

spiraclethemes-site-library/spiraclethemes-site-library/inc/own-shop-functions.php

Spiraclethemes Site Library [newprod] Shortcode

The SpiracleThemes Site Library shortcode is a powerful tool for displaying new products on your WordPress site. This shortcode generates a list of the most recent products added to your shop. The ‘prod_count’ attribute specifies the number of products to display, while ‘prod_columns_count’ determines the number of columns. The products are sorted by their ID in descending order, ensuring the newest items are always shown first.

Shortcode: [newprod]

Parameters

Here is a list of all possible newprod shortcode parameters and attributes:

  • prod_count – determines the number of products to display
  • prod_columns_count – sets the number of columns for the product layout
  • orderby – sorts the products by ‘id’
  • order – arranges the products in descending order
  • visibility – shows only those products which are visible

Examples and Usage

Basic example – A simple usage of the shortcode to display new products in a shop. By default, it will show the 8 latest products in a 4 column layout.

[newprod /]

Advanced examples

Displaying 12 latest products in a 3 column layout. This is achieved by specifying the ‘prod_count’ and ‘prod_columns_count’ attributes in the shortcode.

[newprod prod_count="12" prod_columns_count="3" /]

Displaying 5 latest products in a 5 column layout. This is achieved by specifying the ‘prod_count’ and ‘prod_columns_count’ attributes in the shortcode.

[newprod prod_count="5" prod_columns_count="5" /]

Displaying 10 latest products in a 2 column layout. This is achieved by specifying the ‘prod_count’ and ‘prod_columns_count’ attributes in the shortcode.

[newprod prod_count="10" prod_columns_count="2" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [newprod] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('newprod', 'spiraclethemes_site_library_own_shop_newprod');

Shortcode PHP function:

function spiraclethemes_site_library_own_shop_newprod($atts, $content = null) {
        extract(shortcode_atts(array(
            'prod_count' => '8',
            'prod_columns_count' => '4',
        ), $atts));
        
        ?>
            <div class="list-products-section">
                <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'" orderby="id" order="DESC" visibility="visible"]'); ?>
            </div>
        <?php
      
    }

Code file location:

spiraclethemes-site-library/spiraclethemes-site-library/inc/own-shop-functions.php

Spiraclethemes Site Library [popularprod] Shortcode

The SpiracleThemes Site Library shortcode is a powerful tool for displaying popular products on your site. The shortcode allows you to set the number of products (prod_count) and the number of columns (prod_columns_count) to display. By default, it shows the top 8 best-selling products in a 4-column layout. The products are wrapped in a “list-products-section” div for easy styling.

Shortcode: [popularprod]

Parameters

Here is a list of all possible popularprod shortcode parameters and attributes:

  • prod_count – Determines the number of best-selling products to display.
  • prod_columns_count – Specifies the number of columns in the product display grid.

Examples and Usage

Basic example – Display the eight best-selling products in a 4-column layout using the ‘popularprod’ shortcode.

[popularprod /]

Advanced examples

Display the top 10 best-selling products in a 5-column layout. The ‘prod_count’ parameter is used to limit the number of products displayed, and the ‘prod_columns_count’ parameter is used to specify the number of columns.

[popularprod prod_count="10" prod_columns_count="5" /]

Display only the top 3 best-selling products in a 3-column layout. This can be useful for creating a compact, high-impact display of your most popular products.

[popularprod prod_count="3" prod_columns_count="3" /]

Display the top 12 best-selling products in a 2-column layout. This can be useful for creating a more detailed, comprehensive display of your popular products.

[popularprod prod_count="12" prod_columns_count="2" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [popularprod] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('popularprod', 'spiraclethemes_site_library_own_shop_popularprod');

Shortcode PHP function:

function spiraclethemes_site_library_own_shop_popularprod($atts, $content = null) {
        extract(shortcode_atts(array(
            'prod_count' => '8',
            'prod_columns_count' => '4',
        ), $atts));
        
        ?>
            <div class="list-products-section">
                <?php echo do_shortcode('[products limit="'.$prod_count.'" columns="'.$prod_columns_count.'" best_selling="true" ]'); ?>
            </div>
        <?php
      
    }

Code file location:

spiraclethemes-site-library/spiraclethemes-site-library/inc/own-shop-functions.php

Spiraclethemes Site Library [recentblog] Shortcode

The Spiraclethemes-site-library plugin shortcode ‘recentblog’ displays the most recent blog posts. It allows customization of the post count, category, and display options. The PHP function extracts attributes like post count, category, and display options. It then queries and displays the posts in a styled layout. The layout includes the post’s thumbnail, date, title, and an optional excerpt and ‘read more’ link.

Shortcode: [recentblog]

Parameters

Here is a list of all possible recentblog shortcode parameters and attributes:

  • posts_count – determines the number of posts to display
  • post_cat_slug – filters posts by the specified category slug
  • post_display_excerpt – if set to true, post excerpts will be displayed
  • post_display_readmore – if set to true, a “read more” link will be shown
  • post_read_more – sets the text for the “read more” link

Examples and Usage

Basic Example – Showcases the usage of the shortcode to display the three most recent blog posts.

[recentblog posts_count=3]

Advanced Examples

Displaying the five most recent blog posts from a specific category by using the ‘post_cat_slug’ parameter. The shortcode will only display posts that belong to the ‘news’ category.

[recentblog posts_count=5 post_cat_slug=news]

Displaying the three most recent blog posts with the post excerpt and a ‘Read More’ link. The ‘post_display_excerpt’ and ‘post_display_readmore’ parameters are set to ‘true’ to enable this feature.

[recentblog posts_count=3 post_display_excerpt=true post_display_readmore=true]

Displaying the three most recent blog posts with a custom ‘Read More’ text. The ‘post_read_more’ parameter is used to customize the text of the ‘Read More’ link.

[recentblog posts_count=3 post_display_readmore=true post_read_more="Continue Reading"]

Displaying the three most recent blog posts from multiple categories. The ‘post_cat_slug’ parameter is used with multiple category slugs separated by a comma.

[recentblog posts_count=3 post_cat_slug="news,events,updates"]

PHP Function Code

In case you have difficulties debugging what causing issues with [recentblog] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('recentblog', 'spiraclethemes_site_library_own_shop_recentblog');

Shortcode PHP function:

function spiraclethemes_site_library_own_shop_recentblog($atts, $content = null) {
        extract(shortcode_atts(array(
            'posts_count' => '3',
            'post_cat_slug' => '',
            'post_display_excerpt' => 'false',
            'post_display_readmore' => 'true',
            'post_read_more' => 'READ MORE'
        ), $atts));

        $post_display_excerpt = ($post_display_excerpt === 'true' || $post_display_excerpt=='1');
        $post_display_readmore = ($post_display_readmore === 'true' || $post_display_readmore=='1');

        $args = array(
            'post_type' => 'post',
            'posts_per_page' => $posts_count,
            'post_status'    => 'publish',
        );
        if($post_cat_slug != '' && $post_cat_slug != 'all'){
            $str = str_replace(' ', '', $post_cat_slug);
            $arr = explode(',', $str);    
            $args['tax_query'][] = array(
              'taxonomy'  => 'category',
              'field'   => 'slug',
              'terms'   => $arr
            );

        }
        query_posts( $args );
        ?>
            <div class="latest-posts-wrapper">
                <div class="latest-posts-lists-wrapper">
                    <div class="latest-posts-content">
                        <?php
                            while ( have_posts() )  : the_post(); ?>
                                <article class="recent-blog-widget">
                                    <div class="blog-post">
                                        <div class="image">
                                            <?php
                                                if ( has_post_thumbnail()) :
                                                    the_post_thumbnail('full');
                                                else :
                                                    $post_img_url = get_template_directory_uri().'/img/no-image.jpg';
                                                    ?><img src="<?php echo esc_url($post_img_url); ?>" alt="<?php esc_attr_e('post-image','spiraclethemes-site-library'); ?>" /><?php
                                                        
                                                endif;
                                            ?>
                                            <div class="post-date bottom-left">
                                                <div class="post-day"><?php the_time(get_option('date_format')) ?></div>
                                            </div>
                                        </div>
                                        <div class="clearfix"></div>
                                        <div class="content">
                                            <h3 class="entry-title">
                                                <?php
                                                    if ( is_sticky() && is_home() ) :
                                                        echo "<i class='la la-thumbtack'></i>";
                                                    endif;
                                                ?>
                                                <a href="<?php echo esc_url( get_permalink()); ?>" rel="bookmark"><?php the_title(); ?></a>
                                            </h3>
                                            <?php
                                                if( true==$post_display_excerpt ) {
                                                    the_excerpt();
                                                    if( true==$post_display_readmore ) {
                                                        ?>
                                                            <div class="read-more">
                                                                <a href="<?php echo esc_url( get_permalink() ); ?>"><?php echo $post_read_more; ?> <i class="la la-long-arrow-alt-right"></i></a>
                                                            </div>
                                                        <?php
                                                    }
                                                }
                                            ?>
                                        </div>
                                    </div>
                                </article>
                            <?php endwhile;
                        ?>
                    </div>
                </div>
            </div>
        <?php
        wp_reset_query();
    }

Code file location:

spiraclethemes-site-library/spiraclethemes-site-library/inc/own-shop-functions.php

Conclusion

Now that you’ve learned how to embed the Spiraclethemes Site Library Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *