Не сохраняется категория для слайдера
-
Дорое время суток!
В админке выбираю категорию для показа в слайдере «без категории» Ее ID — 1. Но настройка не сохраняется. Тема установленная на сайте платная, но используется free-версия. Как прибить категорию «без рубрики» гвоздями помимо админки?
Вот код:function color_blog_front_slider(){ $color_blog_section_slider_option = get_theme_mod( 'color_blog_section_slider_option', false ); if( false == $color_blog_section_slider_option ){ return; } $color_blog_section_top_featured_posts_option = get_theme_mod( 'color_blog_section_top_featured_posts_option', true ); if( true === $color_blog_section_top_featured_posts_option ){ $slider_class = 'has-featured-slider default-width--slider'; }else{ $slider_class = 'no-featured-slider full-width--slider'; } ?> <div class="front-slider-wrapper <?php echo esc_attr( $slider_class ); ?>"> <div class="mt-container"> <div class="front-slider-block"> <div class="front-slider cS-hidden"> <?php $slider_cat_slug = get_theme_mod( 'color_blog_section_slider_cat', '' ); $slider_args = array( 'category_name' => esc_attr( $slider_cat_slug ), 'meta_key' => '_thumbnail_id', 'posts_per_page' => 7 ); $slider_post_query = new WP_Query( $slider_args ); if( $slider_post_query->have_posts() ): while ( $slider_post_query-> have_posts() ): $slider_post_query -> the_post(); $post_id = get_the_ID(); $image_url = get_the_post_thumbnail_url( $post_id, 'large' ); if( !empty( $image_url ) ) { $slider_style = 'style="background:url('. esc_url( $image_url ) .') no-repeat scroll center center; background-size:cover"'; } else { $slider_style = ''; } ?> <div class="slider-post-wrap" <?php echo $slider_style; ?>> <div class="post-thumbnail"> <a href="<?php the_permalink(); ?>"></a> </div> <div class="post-info-wrap"> <div class="post-cat"><?php color_blog_article_categories_list(); ?></div> <div class="entry-meta"> <?php color_blog_posted_on(); color_blog_posted_by(); ?> </div> <?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); ?> </div><!--.post-info-wrap --> </div><!-- .slider-post-wrap --> <?php endwhile; endif; ?> </div><!-- .front-slider --> </div> <!-- .front-slider-block --> <?php if( true == $color_blog_section_top_featured_posts_option ){ $color_blog_top_featured_posts_title = get_theme_mod( 'color_blog_top_featured_posts_title', __( 'Featured News', 'color-blog' ) ); echo '<div class="top-featured-post-main-wrapper">'; if( !empty( $color_blog_top_featured_posts_title ) ){ echo '<div class="features-post-title">'.esc_html( $color_blog_top_featured_posts_title ).'</div><!-- .features-post-title -->'; } $color_blog_top_featured_post_order = get_theme_mod( 'color_blog_top_featured_post_order', 'default' ); $top_featured_post_args = array( 'post_type' => 'post', 'posts_per_page' => 5, // Количество слайдов ); if( 'random' == $color_blog_top_featured_post_order ) { $top_featured_post_args['orderby'] = 'rand'; } $top_featured_post_query = new WP_Query( $top_featured_post_args ); if( $top_featured_post_query -> have_posts() ): echo '<div class="top-featured-post-wrap">'; $featured_post_count = 1; while( $top_featured_post_query -> have_posts() ): $top_featured_post_query -> the_post(); ?> <div id="post-<?php the_ID(); ?>" class="mt-single-post-wrap clearfix"> <div class="post-thumbnail"> <span class="post-number"><?php echo absint( $featured_post_count ); ?></span> <figure style="background: no-repeat center top url(<?php echo get_the_post_thumbnail_url(); ?>); background-size: cover; height: 100px;"> </figure> </div> <div class="mt-post-content"> <div class="entry-meta"> <?php color_blog_posted_on(); color_blog_posted_by(); ?> </div> <header class="entry-header"> <?php the_title( '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h3>' ); ?> </header><!-- .entry-header --> </div> </div><!-- #post-<?php the_ID(); ?> --> <?php $featured_post_count ++; endwhile; echo '</div><!-- .top-featured-post-wrap -->'; endif; echo '</div><!-- .top-featured-post-main-wrapper -->'; } ?> </div> </div><!-- .fron-slider-wrapper --> <?php }
Вот сайт: http://q908121m.beget.tech/
Просмотр 11 ответов — с 1 по 11 (всего 11)
Просмотр 11 ответов — с 1 по 11 (всего 11)
- Тема «Не сохраняется категория для слайдера» закрыта для новых ответов.