WordPress.org

Ready to get started?Download WordPress

Forums

Make Single.PHP output in hReview microformat? (3 posts)

  1. alexdemchak
    Member
    Posted 2 years ago #

    So I need for every post on my site to be in hReview microformat. Is there anyway I can rewrite the code in single.php to do that?

  2. digibucc
    Member
    Posted 2 years ago #

    i had no idea what this was, a quick search showed me an example
    of the format:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    you'll want to create custom post meta for all the extra info you
    will use (rating, summary etc)

    then edit single.php to output code similar to what's above.
    basically build a table and add those class tags, and then
    have it input the custom meta into the span tags

    it's really not bad, so just take it step by step
    and you'll get it done. google is your friend.

  3. digibucc
    Member
    Posted 2 years ago #

    just to further the idea, depending on your theme
    single.php should contain the variable $content.

    you'll want to modify the $content variable to something
    like this (using the first 2 lines of the above code)

    $content = '
    <div class="hreview">
    <span><span class="rating">';
    $content .= $custom_meta_rating;
    $content .= '</span> out of 5 stars</span>';
    
    return $content;

    a note, depending on how you create the custom meta, you will call it different ways, my $custom_meta variable is just an example.

Topic Closed

This topic has been closed to new replies.

About this Topic