• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to user navigation

PopWP

WordPress and Genesis Tutorials

  • Get Started
  • About
  • Archive
  • Services
  • Membership
  • My Account

Show WP-PostRatings Plugin Ratings in Genesis

Last Updated on September 4, 2019 Favorited: 1 times

WP-PostRatings is one of my favorite plugin.

This tutorial provides the steps to add and show WP-PostRatings plugin stars rating in any theme based on genesis framework.

There are different ways to show the rating option. You can use shortcode or simple a tiny php function. Here are some of the recommended ways.

Use on of the following in functions.php of your child theme.

TYPE 1

add_action('genesis_after_entry_content', 'wp_post_ratings');
function wp_post_ratings() {
	if ( is_singular('post') && function_exists('the_ratings')) { 
		the_ratings(); 
	}
}

TYPE 2

add_action('genesis_entry_content', 'shortcode_wp_postratings');
function shortcode_wp_postratings() {
    if ( ! is_singular('post') || ! function_exists('the_ratings') ) {
       return;
	}
	echo do_shortcode('[ratings]');
}

TYPE 3

add_action('genesis_entry_content', 'shortcode_wp_postratings');
function shortcode_wp_postratings() {
    if ( ! is_singular('post') ) {
       return;
	}
	
	?>
<div class="wp-postratings">
	<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
</div>
	<?php
}

You can add additional post and page type by following WordPress conditional tags.

Replace

is_singular( 'post' )

with

is_singular( array( 'post', 'book' ) )

Change book to your post type i.e page, services, foods.

Categories: Free Content, Genesis Tutorials, WordPress Tutorials Tags: wp postratings

Reader Interactions

Primary Sidebar

Search

WPEngine WordPress Hosting, Perfected.

Hosting You are looking for?.
Perfect solution for small business to global enterprise.

Learn more

StudioPress Genesis Theme Framework

The No.1 Theme Provider.
Creative, SEO rich Theme for all niche projects.

Learn more

Categories

  • Free Content
  • Genesis Tutorials
  • Premium Content
  • Snippets
  • What's New?
  • WordPress Tutorials

Tag Cloud

Archive Background Section blog canvas menu center logo columns conditional tags CSS CSS Grid custom Customizer custom post type Custom Post Types custom template Custom Widget effect eNews Extended Featured Image front-page Genesis Genesis Sample header right hero section Image Background js layout left menu Logo menu Navigation Menu newsletter post page related posts responsive menu search search widget Shrinking Logo site header slide in-out Stylesheet Template Utility Bar Video Background widgets WordPress

Built with Genesis Framework + WordPress by Aryan Raj

  • Contact
  • FAQ
  • Disclaimer
  • Privacy Policy
  • Copyright Policy
  • Terms of Service