Exemple #1
0
	<?php 
if (is_singular() && has_post_thumbnail()) {
    ?>
		<header id="hero-header">
			<?php 
    the_post_thumbnail();
    ?>
			<div class="info">
				<span><?php 
    if (is_review()) {
        echo 'Review';
    }
    ?>
</span>
				<h1><span <?php 
    if (is_review()) {
        echo 'itemprop="itemReviewed"';
    }
    ?>
><?php 
    the_title();
    ?>
</span></h1>
				<p class="subtitle"><?php 
    the_subtitle();
    ?>
</p>
				<?php 
    if (is_single()) {
        ?>
					<a href="<?php 
Exemple #2
0
function the_review($post = 0)
{
    $post = get_post($post);
    $id = $post->ID;
    if (is_review()) {
        ?>
		<section id="rating">
			<table id="breakdown">
				<tr>
					<td><i class="icon-heart"></i><?php 
        echo get_option('lg_review_options')['labels']['positives'];
        ?>
</td>
					<td><i class="icon-heart-broken"></i><?php 
        echo get_option('lg_review_options')['labels']['negatives'];
        ?>
</td>
				</tr>
				<tr>
					<td><?php 
        echo get_post_meta($id, 'review', true)['positives'];
        ?>
</td>
					<td><?php 
        echo get_post_meta($id, 'review', true)['negatives'];
        ?>
</td>
				</tr>
			</table>
			<table id="score">
			<?php 
        $scores = get_post_meta($id, 'review', true);
        foreach ($scores as $key => $value) {
            if (is_numeric($value) && $key != 'total_score') {
                ?>
					<tr>
						<td><?php 
                echo strpretty($key);
                ?>
</td>
						<td><hr></td>
						<td><?php 
                the_score($value);
                ?>
</td>
					</tr>
				<?php 
            }
        }
        ?>
			</table>
			<div id="overall-rating">
				<div id="score-ring">
					<div class="ring-half" id="left-half"></div>
					<div class="ring-half" id="right-half"></div>
				</div>
				<div class="score-num">
					<span class="icon-back">
						<i class="icon-heart"></i>
					</span>
					<span class="num">
						<?php 
        the_score(get_the_total_score());
        ?>
					</span>
				</div>
			</div>
			<div id="bottom-line">
				<div>
					<?php 
        echo get_option('lg_review_options')['labels']['bottom_line'];
        ?>
				</div>
				<?php 
        echo get_post_meta($id, 'review', true)['bottom_line'];
        ?>
			</div>
		</section>
		<style type="text/css">
			<?php 
        if (get_the_total_score() > 50) {
            ?>
				#score-ring{
					clip: auto;
				}
				#score-ring #right-half{
					transform: rotate(180deg);
				}
				#score-ring #left-half{
					transform: rotate(<?php 
            echo 360 / 100 * the_score_num(get_the_total_score(), false) . 'deg';
            ?>
);
				}
			<?php 
        } else {
            ?>
				#score-ring #right-half{
					transform: rotate(<?php 
            echo 360 / 100 * the_score_num(get_the_total_score(), false) . 'deg';
            ?>
);
				}
			<?php 
        }
        ?>
		</style>
	<?php 
    }
}