Edit File: post-3.php
<?php defined( 'ABSPATH' ) || exit; // Exit directly $metabox_options = get_post_meta( get_the_ID(), 'orun_post_opt', true ); $view = get_post_meta( get_the_ID(), 'post_views_count', true ); ?> <?php if (!empty($metabox_options['orun-meta-opt-primary-category'])) { $primarycat = get_term($metabox_options['orun-meta-opt-primary-category']); $term_id = $primarycat->term_id; } else { $categories = get_the_category(); if (!empty($categories)) { $term_id = $categories[0]->term_id; } } $bg_color = '#000'; $text_color = '#fff'; if (isset($term_id)) { global $wpdb; $table_name = $wpdb->prefix . 'termmeta'; $bg_color_meta_key = 'bg_color'; $bg_color_value = $wpdb->get_var($wpdb->prepare("SELECT meta_value FROM $table_name WHERE term_id = %d AND meta_key = %s", $term_id, $bg_color_meta_key)); if ($bg_color_value) { $bg_color = $bg_color_value; } } ?> <div class="orun-pm-item orun-col-p50 orun-col-p100-oc orun-col-p100-sm"> <div class="orun-pm-img"> <a class="post-thumbnail" rel="nofollow" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php if (has_post_thumbnail()) { the_post_thumbnail('orun-md', array( 'alt' => the_title_attribute(array( 'echo' => false, )), )); } else { echo '<img src="' . get_template_directory_uri() . '/assets/img/nothumb.jpg" alt="No Thumbnail" width="390" height="220">'; } ?> </a> <a style="color: <?php echo $text_color; ?> !important; background-color: <?php echo $bg_color; ?> !important;" rel="nofollow" href="<?php if (!empty($metabox_options['orun-meta-opt-primary-category'])) { $primarycat = get_term( $metabox_options['orun-meta-opt-primary-category'] ); echo esc_url(get_category_link($primarycat->term_id)); } else { $categories = get_the_category(); if (!empty($categories)) { echo esc_url(get_category_link($categories[0]->term_id)); } } ?>" class="orun-pm-cat top-6"><span><?php if (!empty($metabox_options['orun-meta-opt-primary-category'])) { $primarycat = get_term($metabox_options['orun-meta-opt-primary-category']); echo $primarycat->name; } else { $categories = get_the_category(); if (!empty($categories)) { echo $categories[0]->name; } } ?></span> </a> </div> <div class="orun-pm-text"> <h3 class="post-title"><a rel="nofollow" href="<?php echo the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> </h3> <div class="orun-pm-meta"> <div class="meta-start"> <span> <a rel="nofollow" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"> <i class="fas fa-user-circle"></i> <?php echo get_the_author_meta('display_name'); ?> </a> </span> <span> <i class="far fa-clock"></i> <?php orun_posted_on(); ?> </span> </div> <div class="meta-end"> <span><i class="far fa-comment"></i> <?php echo get_comments_number(); ?></span> <span style="color: #e74c3c;"><i class="fas fa-bolt"></i> <?php echo $view;?></span> </div> </div> </div> </div>