• Resolved BongSong

    (@bongsong)


    On the Faq section it has information about Displaying Most Rated Post and other display options.

    Apologies if this is a stupid question but it doesn’t specifically state where exactly should these php functions codes go?

    Inside the post when you’re editing it or inside the function.php file.

    I currently put [ratings] in my posts to display the voting options and results.

    I want to display the top three most rated underneath for purposes of tempting them to click on those posts to peek at them. (That is if it provides a link to those top three posts as well)

    It would look something like:

    Here’s what others are voting on!

    [top three posts shortcode here]

    I realize there is a widget but I don’t want to go this route.

    Thanks for any help in advance.

    James

    https://wordpress.org/plugins/wp-postratings/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Lester Chan

    (@gamerz)

    The PHP functions goes within the loop https://codex.wordpress.org/The_Loop because it really differs from theme to theme, I cannt be explict. You have to consult your theme author.

    If you want to put the most rated post you have to put it in the single post template and use the PHP function and I already answered it in your http://wordpress.org/support/topic/most-rated-shortcode?replies=2. There is no shortcode for it.

    Thread Starter BongSong

    (@bongsong)

    Lester,

    First of all thanks for your assistance. And sorry for the duplicate posts earlier. Had an issue with my browser.

    I am frankly confused. I am looking for the php code:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    in the single.php file. It doesn’t exist in index.php either as instructed on the faq.

    I am using wp 3.1.2 and using the twentyten theme.

    I understand that once I find this:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    I need to paste the php code as instructed on the faq for inserting most rated posts.

    I understand that I could do this within a widget but this is not an option I want to use.

    I’m hoping to insert it directly after the [ratings] shortcode in the post.

    More guidance please?

    Plugin Author Lester Chan

    (@gamerz)

    Thread Starter BongSong

    (@bongsong)

    Lester,

    Thanks, that works.

    I have updated my single-loop.php by placing the php function for highest rated posts.

    However this line:

    Default: get_most_rated(‘post’, 0, 3)

    is being echoed out into the post. I can’t understand why and I assume I need that part of the code so it knows about the 0 and 3 value on displaying the posts.

    I copied exactly as it was in your faq page.

    What am I doing wrong? Paste the code I need to use please?

    Thanks.

    Plugin Author Lester Chan

    (@gamerz)

    Try this as stated in the FAQ “Use” block

    <?php if (function_exists('get_most_rated')): ?>
        <ul>
            <?php get_most_rated('post', 0, 3); ?>
        </ul>
    <?php endif; ?>

    Thread Starter BongSong

    (@bongsong)

    Lester,

    Thanks. This works.

    One final question if I could…

    How could I add a title to that block of code you provided so it gives the top three highest scored posts a title?

    Something like “Check out these other posts and vote!”
    Then underneath are the three posts

    Thanks for your patience and help. 🙂

    Plugin Author Lester Chan

    (@gamerz)

    Just add <?php echo 'Check out these other posts and vote!'; ?> before that block of code?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Where to insert php functions?’ is closed to new replies.