Edit File: archive.php
<?php /** * Archive page (Category, tag, search results etc.) * * @link https://developer.wordpress.org/themes/basics/template-hierarchy/ * * @package orun */ defined( 'ABSPATH' ) || exit; // Exit directly $options = get_option( 'orun_opt' ); // Options get_header(); $text_color = '#fff'; // Örnek yazı rengi $bg_color = '#000'; // Örnek arka plan rengi $category = get_queried_object(); // Bu satırı ekledik $category_background_image_id = get_term_meta($category->term_id, 'category_background_image', true); if (!empty($category_background_image_id)) { $category_background_image_url = wp_get_attachment_url($category_background_image_id); if ($category_background_image_url) { $bg_style = 'background: linear-gradient(to bottom, #00000085, #00000085), url(' . esc_url($category_background_image_url) . ') no-repeat center center / cover !important;'; $text_color = '#fff'; } } else { $bg_style = 'background-color: ' . $bg_color . ' !important;'; } ?> <main id="primary" class="site-main"> <div class="archive-title" style="<?php echo $bg_style; ?>"> <div class="container"> <?php if ( $options['orun-opt-archive-breadcrumb'] == true ) { ?> <ol> <li><a href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('Anasayfa', 'orun'); ?></a></li> <li> • </li> <li><?php the_archive_title(); ?></li> </ol> <?php } archive_breadcrumb_schema(); the_archive_title( '<h1 class="page-title">', '</h1>' ); the_archive_description( '<div class="archive-description"><p>', '</p></div>' ); ?> </div> </div> <div id="orun-home-area" class="container"> <div class="row"> <div id="orun-home-main"> <?php if ($options['orun-opt-archive-page-design'] == 'post-module-1') { $orunpmclass = 'orun-pm-1'; } elseif ($options['orun-opt-archive-page-design'] == 'post-module-2') { $orunpmclass = 'orun-pm-2'; } elseif ($options['orun-opt-archive-page-design'] == 'post-module-3') { $orunpmclass = 'orun-pm-4'; } elseif ($options['orun-opt-archive-page-design'] == 'post-module-4') { $orunpmclass = 'orun-pm-6'; } else { $orunpmclass = 'orun-pm-1'; } ?> <div class="row orun-pm <?php echo $orunpmclass ?>"> <?php if (have_posts() ) { while ( have_posts() ) : the_post(); if ($options['orun-opt-archive-page-design'] == 'post-module-1') { get_template_part( 'template-parts/post/post','1' ); } elseif ($options['orun-opt-archive-page-design'] == 'post-module-2') { get_template_part( 'template-parts/post/post','2' ); } elseif ($options['orun-opt-archive-page-design'] == 'post-module-3') { get_template_part( 'template-parts/post/post','4' ); } elseif ($options['orun-opt-archive-page-design'] == 'post-module-4') { get_template_part( 'template-parts/post/post','6' ); } else { get_template_part( 'template-parts/post/post','1' ); } endwhile; ?> </div> </div> <?php get_sidebar(); ?> </div> </div> </div> </main><!-- #main --> <?php get_sidebar(); get_footer(); the_posts_pagination( array( 'mid_size' => 1, 'prev_text' => __( '<i class="fas fa-angle-left"></i> Önceki', 'orun' ), 'next_text' => __( 'Sonraki <i class="fas fa-angle-right"></i>', 'orun' ), ) ); } else { echo '</div>'; echo _e('Üzgünüz yazı bulunamadı.', 'orun'); } ?> </div> </div> </div> </div> </main><!-- #main --> <?php get_sidebar(); get_footer();