[resolved] Where to place the plugin code in 2014 theme? (4 posts)

  1. Fritsje
    Posted 1 year ago #


    I installed this plugin and followed the installation instructions:

    Open wp-content/themes/<YOUR THEME NAME>/index.php
    You may place it in archive.php, single.php, post.php or page.php also.
    Find: <?php while (have_posts()) : the_post(); ?>
    Add Anywhere Below It (The Place You Want The Ratings To Show): <?php if(function_exists('the_ratings')) { the_ratings(); } ?>

    I did this for a blog using Graphene theme: no worky. There is a support thread on the Graphene theme forum about this (http://forum.graphene-theme.com/graphene-support/help-me-to-use-the-plugin-wp-postratings-in-graphene-theme), but it is closed and not resolved. I guess this plugin just doesn't play nice with Graphene.

    So I moved on to another blog of mine using twentyfourteen theme and also followed the instructions above. Still not working.
    I emptied the page cache (W3 total cache) after the install and update of the index.php file, but nothing.

    Then I edited conten-*.php files for this theme to have it show up on every type of post (as suggested here: http://wordpress.org/support/topic/post-ratings-display-locations?replies=2), but still nothing.

    The plugin is activated, caches are emptied, but nothing shows up.

    Any help on getting this plugin to work on 2014 theme?


  2. Lester Chan
    Plugin Author

    Posted 1 year ago #

    How about the content.php? It works for me http://lesterchan.net/wordpress_dev/ It is placed after the the_post_link() in content.php of twentyfourteen theme.

  3. Fritsje
    Posted 1 year ago #

    Thanks for you reply, but it does not show up for me, anywhere.

    I see on your test-site that you have the rating-stars in the content-sidebar too.

    I have a slightly adjusted version of 2014 but to be clear:

    After installing and activating the plugin I need to put this code:
    <?php if(function_exists('the_ratings')) { the_ratings(); } ?>

    in content.php of my 2014 child theme folder, which looks like this:

     * The default template for displaying content
     * Used for both single and index/archive/search.
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<!-- <?php twentyfourteen_post_thumbnail(); ?> -->
    	<header class="entry-header">
    		<?php if ( in_array( 'category', get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    		<div class="entry-meta">
    			<span class="cat-links"><?php echo get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfourteen' ) ); ?></span>
    			if ( is_single() ) :
    				the_title( '<h1 class="entry-title">', '</h1>' );
    			else :
    				the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' );
    		<div class="entry-meta">
    				if ( 'post' == get_post_type() )
    				if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) :
    			<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span>
    				edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' );
    		</div><!-- .entry-meta -->
    	</header><!-- .entry-header -->
    	<?php if ( is_search() ) : ?>
    	<div class="entry-summary">
    		<?php the_excerpt(); ?>
    	</div><!-- .entry-summary -->
    	<?php else : ?>
    	<div class="entry-content">
    			the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyfourteen' ) );
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    			) );
    	</div><!-- .entry-content -->
    	<?php endif; ?>
    	<?php the_tags( '<footer class="entry-meta"><span class="tag-links">', '', '</span></footer>' ); ?>
    </article><!-- #post-## -->

    [Moderator Note: Please post code & markup between backticks or use the code button (not the blockquote one). Your posted code may now have been permanently damaged by the forum's parser.]

    I cannot find "the_post_link()" in there, so have no idea where to place the code (tried a few spots though, but no luck).

    Thanks for your help.

  4. Fritsje
    Posted 1 year ago #

    Nevermind, I got it to show up. Didn't empty the page caches again. Problem solved!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic