Web view>/img/star-normal.png" alt="">

21
For single.php file <?php get_header(); ?> <!--breadcrumb starts--> <section class="breadcrumb-section"> <div class="container"> <ol class="breadcrumb"> <li><a href="<?php bloginfo('url'); ? >">Home</a></li> <li class="active"><?php the_title(); ?></li> </ol> </div> </section> <!--breadcrumb ends--> <!--content starts--> <section class="content-container inner-content"> <div class="container"> <div class="row"> <div class="col-md-9"> <?php while(have_posts()) : the_post(); ?> <!--inner banner starts-->

Transcript of Web view>/img/star-normal.png" alt="">

Page 1: Web view>/img/star-normal.png" alt="">

For single.php file

<?php get_header(); ?>

<!--breadcrumb starts-->

<section class="breadcrumb-section">

<div class="container">

<ol class="breadcrumb">

<li><a href="<?php bloginfo('url'); ?

>">Home</a></li>

<li class="active"><?php the_title(); ?></li>

</ol>

</div>

</section>

<!--breadcrumb ends-->

<!--content starts-->

<section class="content-container inner-content">

<div class="container">

<div class="row">

<div class="col-md-9">

<?php

while(have_posts()) : the_post(); ?>

<!--inner banner starts-->

<div class="inner-banner">

Page 2: Web view>/img/star-normal.png" alt="">

<figure class="photo"><img src="<?php bloginfo

('template_url'); ?>/img/post-page-banner.jpg"

alt=""></figure>

</div>

<!--inner banner ends-->

<div class="blog-details-left">

<h1><?php the_title(); ?></h1>

<div class="total-comment-star"> <span

class="votes">

<?php

global $wpdb;

$postID = get_the_ID();

// Calculate average rating and

total ratings

$results = $wpdb->get_results("

SELECT ".$wpdb->prefix."commentmeta.meta_value

FROM ".$wpdb->prefix."comments

LEFT JOIN ".$wpdb-

>prefix."commentmeta

ON ".$wpdb-

>prefix."comments.comment_ID = ".$wpdb-

Page 3: Web view>/img/star-normal.png" alt="">

>prefix."commentmeta.comment_id

WHERE ".$wpdb-

>prefix."comments.comment_post_ID =

'".mysql_real_escape_string($postID)."'

AND ".$wpdb-

>prefix."comments.comment_approved = '1'

AND ".$wpdb-

>prefix."commentmeta.meta_key = 'crfp-rating'

AND ".$wpdb-

>prefix."commentmeta.meta_value != 0

GROUP BY ".$wpdb-

>prefix."commentmeta.comment_id");

$totalRatings = 0;

$averageRating = 0;

if (count($results) > 0) {

$totalRatings = count($results);

foreach ($results as $key=>

$result) {

Page 4: Web view>/img/star-normal.png" alt="">

$totalRating += $result-

>meta_value;

}

$averageRating = (($totalRatings

== 0 OR $totalRating == 0) ? 0 : round(($totalRating /

$totalRatings), 0));

}

?>

Average: <?php echo $averageRating; ?> (<?php

echo $totalRatings; ?> votes)<br>

<?php if($averageRating!='') : echo $ratingHTML

= '<div class="crfp-rating crfp-rating-'.

$averageRating.'"></div>'; else : echo "No Rating"; endif;

?>

</span>

<span class="total-comment"> <i><?php

comments_number( '0', '1', '%' ); ?></i>Comments</span>

Page 5: Web view>/img/star-normal.png" alt="">

<div class="like-btn">

<?php echo do_shortcode('[hupso]'); ?>

</div>

</div>

<?php the_content(); ?>

<?php endwhile; ?>

<!--comment form starts-->

<?php if ( comments_open() ||

get_comments_number() ) {

comments_template();

} ?>

<!--comment form ends-->

<div class="RelatedArticles">

<h2>Related Articles</h2>

<div class="blog-post-listing-box">

<?php

$related = get_posts( array( 'category__in' =>

Page 6: Web view>/img/star-normal.png" alt="">

wp_get_post_categories($post->ID), 'numberposts' => 3,

'post__not_in' => array($post->ID) ) );

if( $related ) foreach( $related as $post ) {

setup_postdata($post); ?>

<?php

global $wpdb;

$postid = get_the_ID();

// Calculate average rating and

total ratings

$resultsrel = $wpdb->get_results("

SELECT ".$wpdb->prefix."commentmeta.meta_value

FROM ".$wpdb->prefix."comments

INNER JOIN ".$wpdb-

>prefix."commentmeta

ON ".$wpdb-

>prefix."comments.comment_ID = ".$wpdb-

>prefix."commentmeta.comment_id

WHERE ".$wpdb-

>prefix."comments.comment_post_ID =

'".mysql_real_escape_string($postid)."'

Page 7: Web view>/img/star-normal.png" alt="">

AND ".$wpdb-

>prefix."comments.comment_approved = '1'

AND ".$wpdb-

>prefix."commentmeta.meta_key = 'crfp-rating'

AND ".$wpdb-

>prefix."commentmeta.meta_value != 0

GROUP BY ".$wpdb-

>prefix."commentmeta.comment_id");

$totalRatings = 0;

$averageRating = 0;

if (count($resultsrel) > 0) {

$totalRatingsr = count

($resultsrel);

foreach ($resultsrel as $key=>

$resultt) {

$totalRatingr += $resultt-

>meta_value;

}

Page 8: Web view>/img/star-normal.png" alt="">

$averageRatings = (($totalRatingsr

== 0 OR $totalRatingr == 0) ? 0 : round(($totalRatingr /

$totalRatingsr), 0));

}

?>

<div class="box"><?php if

(has_post_thumbnail()) : the_post_thumbnail('postimg');

endif; ?>

<div class="details">

<h3><a href="<?php the_permalink(); ?

>"><?php the_title(); ?></a></h3>

<?php $content = get_the_content();

$limitcontent =

string_limit_words($content,24); ?>

<p><?php echo $limitcontent; ?>...</p>

</div>

<div class="share-star"><span

class="share"><a href="#"><img src="<?php bloginfo

Page 9: Web view>/img/star-normal.png" alt="">

('template_url'); ?>/img/share-icon.png" alt=""> Share</a>

<a href="#"><img src="<?php bloginfo('template_url'); ?

>/img/comments-icon-new.png" alt=""> <?php

comments_number( '0', '1', '%' ); ?></a></span> <span

class="star">

<?php if($averageRatings!

=''){ echo $relrate = '<div class="crfp-rating crfp-

rating-'.$averageRatings.'"></div>'; }else{ echo "No

Rating Yet"; } ?></span></div>

</div>

<?php $averageRatings=0;$totalRatingr=0;} ?>

<?php wp_reset_query(); ?>

</div>

</div>

</div>

</div>

<div class="col-md-3">

Page 10: Web view>/img/star-normal.png" alt="">

<div class="jump-banner"><img src="<?php bloginfo

('template_url'); ?>/img/jump-banner.jpg" alt=""></div>

<div class="time-to-take"><img src="<?php

bloginfo('template_url'); ?>/img/time-to-take.jpg"

alt=""></div>

<div class="bmi-banner"><a href="<?php

the_permalink(); ?>/bmi-calculator/"><img src="<?php

bloginfo('template_url'); ?>/img/bmi-banner.jpg"

alt=""></a></div>

<?php /*?> <div class="facebook-box"> <img

src="img/facebook-box.jpg" alt=""> </div>

<div class="twitter-box"> <img src="img/twitter-

box.jpg" alt=""> </div><?php */?>

</div>

</div>

</div>

</section>

<!--content ends-->

<?php get_footer(); ?>

Page 11: Web view>/img/star-normal.png" alt="">

For category.php

<?php get_header(); ?>

<!--breadcrumb starts-->

<section class="breadcrumb-section">

<div class="container">

<ol class="breadcrumb">

<li><a href="#">Home</a></li>

<li><a href="#">Training</a></li>

<li class="active">Chest Training</li>

</ol>

</div>

</section>

<!--breadcrumb ends-->

<!--content starts-->

<section class="content-container inner-content">

<div class="container">

<div class="row">

<div class="col-md-9">

<!--inner banner starts-->

Page 12: Web view>/img/star-normal.png" alt="">

<div class="inner-banner">

<figure class="photo">

<?php

//first get the current category ID

$cat_id = get_query_var('cat');

//then i get the data from the database

$cat_data = get_option("category_$cat_id");

//and then i just display my category image if

it exists

if (isset($cat_data['img'])){

echo '<img src="'.$cat_data['img'].'">';

}else{

?>

<?php /*?><img src="<?php bloginfo

('template_url'); ?>/img/training-banner1.jpg" alt=""><?

php */?>

<?php echo ""; } ?>

</figure>

<div class="details">

<?php if (isset($cat_data['bannertitle'])){ ?>

<h3><?php echo $cat_data['bannertitle']; ?

></h3>

<?php }else{ ?>

Page 13: Web view>/img/star-normal.png" alt="">

<!-- <h3>Ideal Pre/Post Workout Nutrition To

Maximize Gains!</h3>-->

<?php echo ""; } ?>

</div>

</div>

<!--inner banner ends-->

<h1><?php if(is_category()): echo

single_cat_title(); endif; ?></h1>

<div class="blog-post-listing-box">

<ul class="masonry post-listing-box three_col

clearfix">

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

<?php

global $wpdb;

$postid = get_the_ID();

// Calculate average rating and

total ratings

$resultsrel = $wpdb->get_results("

SELECT ".$wpdb->prefix."commentmeta.meta_value

FROM ".$wpdb->prefix."comments

INNER JOIN ".$wpdb-

Page 14: Web view>/img/star-normal.png" alt="">

>prefix."commentmeta

ON ".$wpdb-

>prefix."comments.comment_ID = ".$wpdb-

>prefix."commentmeta.comment_id

WHERE ".$wpdb-

>prefix."comments.comment_post_ID =

'".mysql_real_escape_string($postid)."'

AND ".$wpdb-

>prefix."comments.comment_approved = '1'

AND ".$wpdb-

>prefix."commentmeta.meta_key = 'crfp-rating'

AND ".$wpdb-

>prefix."commentmeta.meta_value != 0

GROUP BY ".$wpdb-

>prefix."commentmeta.comment_id");

$totalRatings = 0;

$averageRating = 0;

if (count($resultsrel) > 0) {

Page 15: Web view>/img/star-normal.png" alt="">

$totalRatingsr = count

($resultsrel);

foreach ($resultsrel as $key=>

$resultt) {

$totalRatingr += $resultt-

>meta_value;

}

$averageRatings = (($totalRatingsr

== 0 OR $totalRatingr == 0) ? 0 : round(($totalRatingr /

$totalRatingsr), 0));

}

?>

<li>

<div class="box">

<a href="<?php the_permalink(); ?>"> <?php

if(has_post_thumbnail()) : the_post_thumbnail('postimg');

endif; ?> </a>

<div class="details"> <span><?php

Page 16: Web view>/img/star-normal.png" alt="">

the_time('F j, Y'); ?></span>

<h3><a href="<?php the_permalink(); ?

>"><?php the_title(); ?></a></h3>

<?php $content = get_the_content();

$limitcontent =

string_limit_words($content,24); ?>

<p><?php echo $limitcontent; ?>...</p>

</div>

<div class="share-star"><span

class="share"><a href="<?php the_permalink(); ?>"><img

src="<?php bloginfo('template_url'); ?>/img/share-

icon.png" alt=""> Share</a> <a href="#"><img src="<?php

bloginfo('template_url'); ?>/img/comments-icon-new.png"

alt=""> <?php comments_number( '0', '1', '%' ); ?

></a></span>

<span class="star"><?php /*?><a

href="#"><img src="<?php bloginfo('template_url'); ?

>/img/star-active.png" alt=""></a><a href="#"><img

Page 17: Web view>/img/star-normal.png" alt="">

src="<?php bloginfo('template_url'); ?>/img/star-

active.png" alt=""></a><a href="#"><img src="<?php

bloginfo('template_url'); ?>/img/star-active.png"

alt=""></a><a href="#"><img src="<?php bloginfo

('template_url'); ?>/img/star-active.png" alt=""></a><a

href="#"><img src="<?php bloginfo('template_url'); ?

>/img/star-normal.png" alt=""></a><?php */?><?php if

($averageRatings!=''){ echo $fdd = '<div class="crfp-

rating crfp-rating-'.$averageRatings.'"></div>'; }else{

echo "No Rating"; } ?> </span></div>

</div>

</li>

<?php $averageRatings=0; $totalRatingr=0;

endwhile; ?>

</ul>

<?php wp_pagenavi(); ?>

Page 18: Web view>/img/star-normal.png" alt="">

</div>

</div>

<div class="col-md-3">

<?php get_sidebar(); ?>

</div>

</div>

</div>

</section>

<!--content ends-->

<?php get_footer(); ?>

add this code in function.php file of your theme

<?php

function format_comment($comment, $args, $depth) {

$GLOBALS['comment'] = $comment; ?>

<li id="li-comment-<?php comment_ID() ?>"> <img src="<?php

bloginfo('template_url'); ?>/img/no-photo.png" alt="">

<div class="details">

<h4><?php printf(__('%s'), get_comment_author_link()) ?

Page 19: Web view>/img/star-normal.png" alt="">

></h4>

<?php if ($comment->comment_approved == '0') : ?>

<em><?php _e( 'Your comment is awaiting moderation.'); ?

></em><br />

<?php endif; ?>

<span class="reply"><!--<a href="#">Reply</a>--><?php

comment_reply_link(array_merge( $args, array('depth' =>

$depth, 'max_depth' => $args['max_depth']))) ?></span>

<small>Posted on: <?php printf(__('%1$s'),

get_comment_date(), get_comment_time()) ?></small>

<p><?php comment_text(); ?></p>

<!--<p class="yes-no">Was this helpful? <a href="#">Yes!

</a> | <a href="#" class="red">No</a></p>-->

</div>

</li>

<?php if ( ! comments_open() ) : ?>

<p class="no-comments"><?php _e( 'Comments are closed.',

'twentyfourteen' ); ?></p>

<?php endif; ?>

<?php }

function disable_comment_url($fields) {

Page 20: Web view>/img/star-normal.png" alt="">

unset($fields['url']);

return $fields;

}

add_filter

('comment_form_default_fields','disable_comment_url');

?>