Edit File: post-1.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-pm-modern-1 orun-col-p100-fw"> <div class="orun-pm-img orun-col-p30"> <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> </div> <div class="orun-pm-text orun-col-p70"> <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" style="background-color:<?php echo $bg_color ?>"><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> <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> <i class="far fa-clock"></i> <?php orun_posted_on(); ?> </span> </div> </div> </div> </div>