Home Forums WC Vendors Pro Support Loading Ratings in Sidebar

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #39219
    dave
    Participant

    How do I programmatically load the rating stars for a vendor on their vendor page.

    #39221
    Anna
    Member

    This is a snip I wrote when I had some custom sidebars on my site.
    Put this in your functions.php file:

    /* RATINGS - SIDEBAR */
    function vendor_feedback_sidebar() { 
    	if ( is_shop() ) { 
    		$vendor_shop 		= urldecode( get_query_var( 'vendor_shop' ) );
    		$vendor_id   		= WCV_Vendors::get_vendor_id( $vendor_shop ); 
    	    
    		if ( ! WCVendors_Pro::get_option( 'ratings_management_cap' ) ) echo WCVendors_Pro_Ratings_Controller::ratings_link( $vendor_id, true );
    		
    	} 
    }

    Then put this where you want the ratings to show up:
    <?php vendor_feedback_sidebar(); ?>

    By the way- if you are going to use the text widget to show this in a sidebar, first you do have to enable the use of php in widgets (if you have not already done so). This snip put in your functions.php will do that:

    /*PHP ALLOWED IN WIDGETS*/
    add_filter('widget_text','execute_php',100);
    function execute_php($html){
         if(strpos($html,"<"."?php")!==false){
              ob_start();
              eval("?".">".$html);
              $html=ob_get_contents();
              ob_end_clean();
         }
         return $html;
    }
    #39223
    dave
    Participant

    Thanks!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.