• Resolved aikorei

    (@aikorei)


    Hi – I’m currently using the auto-insert feature to add reviews to the top of every post (it’s just a standard blog, nothing complicated). I’d like to add this same review to the excerpts on my default blog page, so each blog excerpt has the visitor votes embedded at the bottom of the excerpt (or top, or whatever). That way visitors skimming through articles can see which ones have the best review, then read the ones they like the most.

    What would it take to do this?

    Thanks in advance.

    https://wordpress.org/plugins/yet-another-stars-rating/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor dudo

    (@dudo)

    Hello, thank you for using Yasr!

    Can you please try this solution?
    https://wordpress.org/support/topic/stars-not-showing-up-on-front-page-and-in-categories?replies=2#post-7871409

    (line is now 322)

    Best,
    Dario

    Thread Starter aikorei

    (@aikorei)

    Hi Dudo. Thanks for the lightning fast response – really appreciated.

    I did make the change as you suggested (and thanks for the updated line number), but I don’t notice any change on my blog page. The site is http://ceoparenting.com, if it helps any.

    Also, I’m using WP Super Cache (which I cleared after ftp’ing my updated file). Not sure if that makes a difference or not.

    Again, thanks for the help.

    Thread Starter aikorei

    (@aikorei)

    Just to make sure I entered it in the right place, here’s the full block at the end of the ‘shortcode_visitor_votes_callback’ add_shortcode() function:

    //If overall rating in loop is enabled don't use is_singular && is main_query
            if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
    
                return $shortcode_html;
    
            }
    
            //default value
            else {
    
                if( is_singular() && is_main_query() ) {
    
                    //return $shortcode_html;
                    if (is_singular()) {
    
                        return $shortcode_html;
    
                    }
    
                    else {
    
                        echo $shortcode_html;
    
                    }
    
                }
    
            }
    Plugin Contributor dudo

    (@dudo)

    Just to be sure: did you select “yes” to this question in the yasr settings:

    Show “Visitor Votes” in Archive Page?

    Thread Starter aikorei

    (@aikorei)

    I hadn’t (not realizing this setting was connected), but I just updated it, making sure that setting was marked as ‘yes’, and cleared my cache again, but still no apparent change.

    FWIW, I know you do this in your free time, and don’t expect you to do a full-blown troubleshooting. I do appreciate your time, and the plugin is great so far. This is more of a ‘nice-to-have’ than a ‘must-have’, so no need to waste much effort on it unless you really want to. 🙂

    Plugin Contributor dudo

    (@dudo)

    Can you try to put the shortcode in your theme? (you’ve to use do_shortcode function)

    Thread Starter aikorei

    (@aikorei)

    That worked perfect, thank you. Once I figured out where to put the code (the them author used separate template files I had to track down), this worked the magic:

    <?php echo do_shortcode( '[yasr_visitor_votes]' ) ?>

    Last 2 questions (should be easy). Is there a way (e.g. via shortcode) to change the text before the star ratings? I know there’s a setting for that, but if it’s possible I’d like separate text on the single post page than on the blog page with post excerpts.

    On single post page, I’d like something like “What did you think of this article?” to encourage users to vote. But on the blog page, I’d like something more like “Average reader rating” or something like that to encourage click throughs.

    Finally, is it possible to change star size using shortcode? The stars on the blog page excerpts ignore the setting I have to choose the small stars, so they look much larger than I’d like them.

    Again, thanks for a great plugin and stellar support! Will be sure to donate soon to show my appreciation.

    EDIT: I found the shortcode option for “size” (I should have guessed 🙂 ). So using shortcode [yasr_visitor_votes size="medium"] worked great. Now I just need custom text before, if possible and I’m all good to go.

    Plugin Contributor dudo

    (@dudo)

    1) No, there is only the setting that you saw, sorry 🙂

    …but you can workaround this by editing some code:

    from line 311 change this

    if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
    
                return $shortcode_html;
    
            }
    
            //default value
            else {
    
                if( is_singular() && is_main_query() ) {
    
                    return $shortcode_html;
    
                }
    
            }

    to this

    if ( YASR_SHOW_VISITOR_VOTES_IN_LOOP === 'enabled' ) {
    
                if( is_singular() && is_main_query() ) {
    
                     $shortcode_html = 'YOUR TEXT HERE FOR SINGLE PAGE' . $shortcode_html;
    
                  }
    
                else {
    
                   $shortcode_html = 'YOUR TEXT HERE FOR ARCHIVE PAGE' . $shortcode_html;
    
                 }
    
                 return $shortcode_html;
    
             }
    
    }

    I’ve tested it and it works, but you should do this again everytime you update the plugin.

    Good work!

    P.s. you don’t need to donate, just buy an extension on the yasr official site 🙂

    Thread Starter aikorei

    (@aikorei)

    This worked beautifully. Thanks again! Super happy with things now. 🙂

    Plugin Contributor dudo

    (@dudo)

    Glad to hear 🙂

    If you wish, can you please rate yasr 5 stars ?

    Have a nice day!

    Thread Starter aikorei

    (@aikorei)

    Done – with pleasure! 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Add post review to blog excerpt?’ is closed to new replies.