Simple Tags Shortcodes

Below, you’ll find a detailed guide on how to add the Simple Tags 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 Simple Tags Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Simple Tags Plugin and the shortcodes it provides:

Plugin Icon
TaxoPress is the WordPress Tag, Category, and Taxonomy Manager

"TaxoPress is a comprehensive WordPress plugin for managing Tags, Categories, and Taxonomies. With its slug 'simple-tags', it simplifies taxonomy handling, enhancing your content organization."

★★★★✩ (144) Active Installs: 60000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [st-the-tags]
  • [taxopress_postterms]
  • [taxopress_relatedposts]
  • [taxopress_termsdisplay]

Simple Tags [st-the-tags] Shortcode

The Simple Tags plugin shortcode, ‘st-the-tags’, is used to extend the post tags. It decodes HTML entities and trims the parameter. If the parameter is empty, it defaults to ‘title=’.

Shortcode: [st-the-tags]

Parameters

Here is a list of all possible st-the-tags shortcode parameters and attributes:

  • param – Defines custom settings for the post tags display

Examples and Usage

Basic example – A simple shortcode usage to display the post tags. By default, it will display the title of the tags.

[st-the-tags /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'st-the-tags', array( __CLASS__, 'shortcode' ) );

Shortcode PHP function:

function shortcode( $atts ) {
		$atts = shortcode_atts( array( 'param' => '' ), $atts );
		extract( $atts );

		$param = html_entity_decode( $param );
		$param = trim( $param );

		if ( empty( $param ) ) {
			$param = 'title=';
		}

		return self::extendedPostTags( $param );
	}

Code file location:

simple-tags/simple-tags/inc/class.client.post_tags.php

Simple Tags [taxopress_postterms] Shortcode

The TaxoPress PostTerms shortcode is used to retrieve and display post tags. It extracts the post ID, checks if it exists, and if so, outputs the associated post tags.

Shortcode: [taxopress_postterms]

Parameters

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

  • id – Unique identifier for the specific post terms

Examples and Usage

Basic example – Displaying post tags by referencing the ID of the post.

[taxopress_postterms id=1 /]

Advanced examples

Using the shortcode to display post tags by referencing multiple IDs. This will display the tags of the posts with the given IDs.

[taxopress_postterms id="1,2,3" /]

Using the shortcode with no ID. This will display a message saying “Invalid post terms ID.”

[taxopress_postterms /]

PHP Function Code

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

Shortcode line:

add_shortcode('taxopress_postterms', 'taxopress_posttags_shortcode');

Shortcode PHP function:

function taxopress_posttags_shortcode($atts)
{
    extract(shortcode_atts([
        'id' => 0
    ], $atts));

    $posttags_id = $id;
    $posttagss   = taxopress_get_posttags_data();

    ob_start();
    if (array_key_exists($posttags_id, $posttagss)) {
        $posttags_arg = build_query($posttagss[$posttags_id]);

        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo SimpleTags_Client_PostTags::extendedPostTags($posttags_arg);

    } else {
        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo esc_html__('Invalid post terms ID.', 'simple-tags');
    }

    $html = ob_get_clean();

    return $html;


}

Code file location:

simple-tags/simple-tags/inc/post-tags-action.php

Simple Tags [taxopress_relatedposts] Shortcode

The ‘taxopress_relatedposts’ shortcode from the Simple-Tags plugin is a tool to display related posts. It pulls related posts based on the ID provided in the shortcode. If the ID exists, it generates a list of related posts. If not, it displays a message saying ‘Related Posts not found.’ It’s an efficient way to engage readers with similar content.

Shortcode: [taxopress_relatedposts]

Parameters

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

  • id – The unique ID for the specific related post set.

Examples and Usage

Basic example – Display related posts by referencing the ID of the related posts group.

[taxopress_relatedposts id=1 /]

Advanced examples

Using the shortcode to display related posts by referencing the ID of the related posts group. If the ID is not found, it will display a message ‘Related Posts not found.’

[taxopress_relatedposts id=5 /]

If you want to display related posts from multiple groups, you can use multiple shortcodes in the same post or page. Here is an example of displaying related posts from group ID 1 and 2.

[taxopress_relatedposts id=1 /]
[taxopress_relatedposts id=2 /]

PHP Function Code

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

Shortcode line:

add_shortcode('taxopress_relatedposts', 'taxopress_relatedposts_shortcode');

Shortcode PHP function:

function taxopress_relatedposts_shortcode($atts)
{
    extract(shortcode_atts([
        'id' => 0
    ], $atts));

    $relatedpost_id = $id;
    $relatedposts   = taxopress_get_relatedpost_data();

    ob_start();
    if (array_key_exists($relatedpost_id, $relatedposts)) {
        $related_post_array = $relatedposts[$relatedpost_id];
        $relatedpost_arg    = build_query($related_post_array);

        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
        echo SimpleTags_Client_RelatedPosts::get_related_posts($relatedpost_arg);

    } else {
        echo esc_html__('Related Posts not found.', 'simple-tags');
    }
    
    $html = ob_get_clean();

    return $html;


}

Code file location:

simple-tags/simple-tags/inc/related-posts-action.php

Simple Tags [taxopress_termsdisplay] Shortcode

The TaxoPress TermsDisplay shortcode is a tool that creates a dynamic tag cloud. It extracts data from a specified ‘id’ and uses it to generate a tag cloud.

Shortcode: [taxopress_termsdisplay]

Parameters

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

  • id – A unique number assigned to each tag cloud

Examples and Usage

Basic example – Displays the terms in a tag cloud format by referencing the ID.

[taxopress_termsdisplay id=1 /]

Advanced examples

Display a specific number of terms in a tag cloud by setting the ‘max’ attribute to the desired number. If the ‘max’ attribute is not set, it will display all terms. The ‘color’ attribute can be set to ‘true’ or ‘false’ to enable or disable term color coding, respectively.

[taxopress_termsdisplay id=1 max=10 color=true /]

Display a tag cloud with a specific number of terms and without color coding. This is achieved by setting the ‘max’ attribute to the desired number and the ‘color’ attribute to ‘false’.

[taxopress_termsdisplay id=2 max=20 color=false /]

PHP Function Code

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

Shortcode line:

add_shortcode('taxopress_termsdisplay', 'taxopress_termsdisplay_shortcode');

Shortcode PHP function:

function taxopress_termsdisplay_shortcode($atts)
    {
        extract(shortcode_atts(array(
            'id' => 0
        ), $atts));

        $tagcloud_id = $id;
        $tagclouds = taxopress_get_tagcloud_data();

        ob_start();
        if (array_key_exists($tagcloud_id, $tagclouds)) {
            $tagclouds[$tagcloud_id]['number'] = $tagclouds[$tagcloud_id]['max'];
            if (!isset($tagclouds[$tagcloud_id]['color'])) {
                $tagclouds[$tagcloud_id]['color'] = 'false';
            }
            $tagcloud_arg = build_query($tagclouds[$tagcloud_id]);
            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
            echo SimpleTags_Client_TagCloud::extendedTagCloud( $tagcloud_arg );

        }

        $html = ob_get_clean();
        return $html;


    }

Code file location:

simple-tags/simple-tags/inc/tag-clouds-action.php

Conclusion

Now that you’ve learned how to embed the Simple Tags 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 *