• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Need to add WP-PostRatings PHP code to appear on Posts only

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Need to add WP-PostRatings PHP code to appear on Posts only

This topic is: resolved

Tagged: hooks, post.php, posts only

  • This topic has 2 replies, 2 voices, and was last updated 7 years, 9 months ago by Toby39.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • September 14, 2017 at 10:23 am #211468
    Toby39
    Participant

    Hi folks, I am experimenting with a plugin that enables visitors to rate a Post. I have pasted the PHP <?php while (have_posts()) : the_post(); ?> into Genesis Hooks (inside the loop: genesis_loop) to get the rating system appear at the bottom of my Posts.

    The trouble is, it also appears on every Page.
    Do you know how I could get this to only appear on Posts? I am assuming that I'd need to add the code into post.php, but I am not sure where to add this.

    Any help would be greatly appreciated.

    Thanks
    T

    September 14, 2017 at 11:16 am #211472
    Victor Font
    Moderator

    You didn't follow the plugin's directions properly. You added a loop to the loop. Please review the plugin's directions again: https://wordpress.org/plugins/wp-postratings/

    The loop is an integral part of WordPress and runs on every page and post. It's how content is displayed. You can still use Genesis Simple Hooks, but add the correct code to the after loop hook:

    <?php if( is_single() && function_exists('the_ratings')) { the_ratings(); } ?>


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    September 14, 2017 at 1:23 pm #211475
    Toby39
    Participant

    The only other option I could see is to type the shortcode, in which it looks like I'd have to manually do that on each individual page (not auto.).

    Thank you for your code suggestion, I have placed this in G. Hooks genesis_after_loop and it seems to work a charm.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble