Edit File: grid-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-grid-item 11"> <a rel="nofollow" href="<?php the_permalink(); ?>"> <div class="orun-grid-bg" style="background-image:url('<?php if ( ! empty(get_the_post_thumbnail_url() ) ) { echo get_the_post_thumbnail_url(); } else { echo '' . get_template_directory_uri(). '/assets/img/nothumb.jpg'; } ?>');"> </div> </a> <div class="orun-grid-text"> <div class="orun-grid-cat-div"> <span class="orun-grid-cat-h" style="color: <?php echo $text_color; ?> !important; background-color: <?php echo $bg_color; ?> !important;"> <?php if (!empty($metabox_options['orun-meta-opt-primary-category'])) { $primarycat = get_term($metabox_options['orun-meta-opt-primary-category']); $firstLetter = substr($primarycat->name, 0, 1); echo $firstLetter; } else { $categories = get_the_category(); if (!empty($categories)) { $firstLetter = substr($categories[0]->name, 0, 1); echo $firstLetter; } } ?> </span> <span class="orun-grid-cat" style="color: <?php echo $text_color; ?> !important;"> <?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> </div> <h3><a rel="nofollow" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> </div> </div>