Alimir / wp-ulike

WP ULike enables you to add Ajax Like button into your WordPress and allowing your visitors to like and unlike posts,comments, BuddyPress activities & bbPress Topics
http://alimir.github.io/wp-ulike/
102 stars 27 forks source link

I set for="comment" in the shortcode, but it's still a post type. #91

Closed Taihei-Tatsukawa closed 4 months ago

Taihei-Tatsukawa commented 1 year ago

Sorry, I'm sending the issue again because I made a mistake on the account.

function wp_ulike_shortcode( $atts, $content = null ){
        // Final result
        $result = '';
        // Default Args
        $args   = shortcode_atts( array(
            "for"           => 'post',  // shortcode Type (post, comment, activity, topic)
            "id"            => '',      // Item ID
            "slug"          => 'post',  // Slug Name
            "style"         => '',      // Get Default Theme
            "button_type"   => '',      // Set Button Type ('image' || 'text')
            "attributes"    => '',      // Get Attributes Filter
            "wrapper_class" => ''       // Extra Wrapper class
        ), $atts );

        switch ( $args['for'] ) {
            case 'comment':
                $args["type"] = 'comment';
                $args["slug"] = 'comment';
                $result = $content . wp_ulike_comments( 'put', array_filter( $args ) );
                break;

When a comment is passed to for in wp_ulike_shortcode(), the slug and type are then processed as post, so the tag for the comment is not output. I think I need to define type and slug as comment in the switch statement or in wp_ulike_comments().

I know you're busy, but I'd be happy to get this fixed.