Posts Like Dislike Shortcode

Below, you’ll find a detailed guide on how to add the Posts Like Dislike Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Posts Like Dislike Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Posts Like Dislike Plugin and the shortcodes it provides:

Plugin Icon
Posts Like Dislike

"Posts Like Dislike is a dynamic WordPress plugin that seamlessly enables users to express their opinions on your content through a simple, interactive like or dislike system."

★★★★✩ (17) Active Installs: 5000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [posts_like_dislike]

Posts Like Dislike [posts_like_dislike] Shortcode

The ‘posts_like_dislike’ shortcode is a function that allows users to display a like-dislike feature on their posts. It renders the shortcode by including the ‘like-dislike-render.php’ file.

Shortcode: [posts_like_dislike]

Examples and Usage

Basic example – Show the like and dislike buttons for a specific post by using the post’s ID.

[posts_like_dislike id=1 /]

PHP Function Code

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

Shortcode line:

add_shortcode('posts_like_dislike', array($this, 'render_pld_shortcode'));

Shortcode PHP function:

function render_pld_shortcode($atts)
        {
            $content = '';
            $shortcode = true;
            include(PLD_PATH . '/inc/cores/like-dislike-render.php');
            return $content;
        }

Code file location:

posts-like-dislike/posts-like-dislike/inc/classes/pld-hook.php

Conclusion

Now that you’ve learned how to embed the Posts Like Dislike Plugin shortcode, 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 *