Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

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

[SOLVED] Add "WP Customer Reviews" to Byline


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Mar 6, 2012, 01:09 PM
longnha
 
12 posts · Feb 2012
[SOLVED] Add "WP Customer Reviews" to Byline

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
 
21,714 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
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.
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
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
 
21,714 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
$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.
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
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
 
21,714 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
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.
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/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 08:27 PM.


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