Plugin Contributor
dudo
(@dudo)
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.
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?
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)
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 🙂
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!