Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Plugins & Atahualpa »

[SOLVED] Add "WP Customer Reviews" to Byline


  #1  
Old Mar 6, 2012, 01:09 PM
longnha
 
12 posts · Feb 2012
Hello,

I used "WP Customer Reviews" for my review site. I follow the instruction on this post: http://wordpress.org/support/topic/p...erately-needed to add average ratings.

The problem that is I cannot customize the position of the "average ratings".

Here is an example of how it look like: http://digitalcashpalace.com/forex-b...nk-fx-reviews/ ; now I want to move "Average Rating" to Byline position.

Anyone can help me in this case? thank you very much.

I use wordpress and Atahualpa latest version.


-------------------------------
Also, looking for someone to help me edit the theme, must have experience with "Atahualpa" , compare table and "WP Customer Reviews" (or other reviews-rating plugin). Please let me know how to contact you and maybe the cost also.
  #2  
Old Mar 6, 2012, 02:04 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you (or someone) will have to look at the code of the plugin and determine how it works, then add some code in bfa_post_parts.php to the 'byline' area to display what you want.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Mar 6, 2012, 02:24 PM
longnha
 
12 posts · Feb 2012
According to the guide, to add average rating:

Add the following function anywhere on this file:

HTML Code:
function get_average_rating() {
         global $post;
         $this->get_aggregate_reviews($post->ID);
         $average_score = number_format($this->got_aggregate["aggregate"], 1);

        return $average_score * 20; // 20% for each star if having 5 stars
    }
Then inside the function do_the_content($original_content), just after $the_content = ''; add the following:

HTML Code:
// build average ratings html
        $average_rating = 'Average Rating: <div class="sp_rating"><div class="base"><div class="average" style="width:'.$this->get_average_rating().'%"></div></div></div>';
Then find the following line:

$the_content .= '<div id="wpcr_respond_1">'; /* start the div */

and place the following just below it:

HTML Code:
// attach average ratings to beginning of reviews
        $the_content .= $average_rating;
I follow the guide and it work, but the position is above the reviews, not byline position as I want.


I Edited bfa_post_parts.php and added:
HTML Code:
// build average ratings html
        $average_rating = 'Average Rating: <div class="sp_rating"><div class="base"><div class="average" style="width:'.$this->get_average_rating().'%"></div></div></div>';
Then find the following line:

$the_content .= '<div id="wpcr_respond_1">'; /* start the div */

Inside "byline", I added:

HTML Code:
// build average ratings html
        $average_rating = 'Average Rating: <div class="sp_rating"><div class="base"><div class="average" style="width:'.$this->get_average_rating().'%"></div></div></div>';
// attach average ratings to beginning of reviews
        $the_content .= $average_rating;
But error:
Fatal error: Using $this when not in object context in /home/digital1/public_html/wp-content/themes/atahualpa/functions/bfa_post_parts.php on line 102

Could you please explain what's wrong with the code that I added.

Thank you
  #4  
Old Mar 6, 2012, 02:51 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
$this is a PHP variable. You can do a google search on 'php $this' and read all about it.

Not knowing th eplugin or what they are trying to do, I can not explain why they are using it or why you got the error, but I would guess that it is a problen since you have the code in two different modules. That would be something to discuess with the plugin author.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Mar 6, 2012, 02:54 PM
longnha
 
12 posts · Feb 2012
Quote:
Originally Posted by juggledad
$this is a PHP variable. You can do a google search on 'php $this' and read all about it.

Not knowing th eplugin or what they are trying to do, I can not explain why they are using it or why you got the error, but I would guess that it is a problen since you have the code in two different modules. That would be something to discuess with the plugin author.
Alright, I understood.

The plugin coded by PHP and the theme code by html. I have no other choice but accept the current position or move on another plugin since I don't know how to convert PHP to html.

Thank you very much.
  #6  
Old Mar 6, 2012, 04:09 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
PHP is the language used in the plugin and theme (and wordpress) to create the HTML that the browsers interpret to display your web page (there is some jscript thrown in but it can be ignored in this case.)

If the plugin's author can't help you your choices are to move on to another plugin or hire someone to fix it for you. Good luck.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Mar 6, 2012, 04:27 PM
longnha
 
12 posts · Feb 2012
Quote:
Originally Posted by juggledad
PHP is the language used in the plugin and theme (and wordpress) to create the HTML that the browsers interpret to display your web page (there is some jscript thrown in but it can be ignored in this case.)

If the plugin's author can't help you your choices are to move on to another plugin or hire someone to fix it for you. Good luck.
Could you recommend someone that able to fix it? or someone that able to design the new hold theme. I'm working on it for few days already but cannot seem fix it.

Thank you very much.
  #8  
Old Mar 6, 2012, 05:15 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
I could take a look. If you PM me I will send you my rates.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #9  
Old Mar 6, 2012, 05:21 PM
longnha
 
12 posts · Feb 2012
Quote:
Originally Posted by lmilesw
I could take a look. If you PM me I will send you my rates.
PM sent. Thank you.
  #10  
Old Mar 7, 2012, 08:32 AM
longnha
 
12 posts · Feb 2012
Hello,

I have another small problem with "WP Customer Reviews" and need help:

- I create a new posting template, here it is the example: http://digitalcashpalace.com/press-r...s-and-ratings/

- Now I want to link "Let your voice be heard. Write a review now" (at the top), link to "Rate/write review" box at bottom of the post.

The problem that is the "Rate/write review" box powered by Javascripts so I cannot find actual link to link it.

Could anyone able to find solution for this case? Thank you very much.
  #11  
Old Mar 7, 2012, 09:49 AM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
You could perhaps put an anchor tag in the post footer which would at least take them to where they can add a rating.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #12  
Old Mar 8, 2012, 05:35 AM
longnha
 
12 posts · Feb 2012
I use another plugin with more features and so far it work.

Thank you very much for your support.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add "customer field" after 1st post on multi post page fantasy Center area post/pages 7 Nov 28, 2011 10:33 AM
Integration of "WP Post to PDF" similar to "WP Print" or "WP Mail" neckit Plugins & Atahualpa 4 May 30, 2011 07:44 AM
[SOLVED] How to change my byline from &quot;by&quot; to &quot;posted by&quot; kmages Forum How-To 3 Apr 13, 2011 01:47 PM
Alt Text For "Comment" "Tag" and "Category" gifs jasebishop Atahualpa 3 Wordpress theme 0 Nov 12, 2010 11:09 PM


All times are GMT -6. The time now is 01:02 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.