This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

display "stars" images with extractor add on
#1

Hi Steve

I successfully integrated the code.  Thank you again for the assistance!

I am relatively new to PHP and am not sure how to display an image of the "stars" for the avg rating using extractor.php in the footer of all my pages.

Currently it only displays the avg rating as a number.  See
https://wordpressmu-32488-70219-201219.c...ysapps.com

How would I adapt the code to accomplish this?

Many thanks again!
Reply
#2

I'll be able to have a look at this tomorrow.

Have you completed the interview?
Reply
#3

It looks like you're loading Font Awesome which is good, so I'll make use of that below.

First if you open the extractor.php file and find this section:

PHP Code:
<?php 
if ($average) {
return
$average;
} else {
return
'No ratings yet.';
}

Replace it with this:

PHP Code:
<?php 
if ($average) {
$content = '';

for (
$i = 0; $i < 5; $i++) {
if (
$i < $average) {
$content .= '<span class="star star_full"></span>';
} else {
$content .= '<span class="star star_empty"></span>';
}
}

return
$content;
} else {
return
'No ratings yet.';
}

Then in your stylesheet, add this:

Code:
.star:before {
font-size: 1.1em;
font-family: FontAwesome;
display: inline-block;
content: "\f005";
}

.star_empty {
color: #DDDDDD;
}

.star_full {
color: #FFD700;
}

Have you completed the interview?
Reply
#4

Hi - I tried adding the code as you said,  but the images still aren't showing. To make sure:  Which stylesheet does the css code go in?
Reply
#5

Whichever stylesheet affects the footer of all your pages.

I had another look at your site and it's displaying the number 25 at the bottom left. Is that where you're trying to display it?

Have you completed the interview?
Reply
#6

Thank you! It was a missing end paren. It works now.

Had another q: How do I disable login for admin panel. I've been locked out and it's saying "timeout.." and won't let me reset
Reply
#7

Good to hear the stars are displaying now. Regarding admin login, can you start a new thread for this please.

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Seven Thunders
20-Jun-2019, 03:56 AM
Last Post by Steven
03-Mar-2014, 09:23 PM
Last Post by tykra
13-Dec-2011, 01:27 PM
Last Post by stariocek
29-Aug-2011, 06:09 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)