Доброго дня
установил шаблон для вывода архива заданий archive-task.php
перед циклом установил сл код
для вывода фильтра и для вывода заданий
<?php if(is_post_type_archive('task')||is_tax('task-subject')) get_freelance_task_filter(); ?> <?php query_posts(array('post_type'=>'task')); ?>
публикации вводятся через стандартный шаблон архивов темы
Как вывести задания в таком виде как на этом сайте codeseller
Какой нужно прописать класс и цикл для вывода?
Код архива
<?php if(! defined('ABSPATH')){ return; } /** * Template layout for ARCHIVES * @package Kallyas * @author Team Hogash */ get_header(); /*** USE THE NEW HEADER FUNCTION **/ //** Put the header with title and breadcrumb $title = zn_archive_title(); WpkPageHelper::zn_get_subheader( array( 'title' => $title ) ); // Check to see if the page has a sidebar or not $main_class = zn_get_sidebar_class('archive_sidebar'); if( strpos( $main_class , 'right_sidebar' ) !== false || strpos( $main_class , 'left_sidebar' ) !== false ) { $zn_config['sidebar'] = true; } else { $zn_config['sidebar'] = false; } $zn_config['size'] = $zn_config['sidebar'] ? 'col-sm-8 col-md-9' : 'col-sm-12'; ?> <section id="content" class="site-content" > <div class="container"> <div class="row"> <div id="th-content-archive" class="<?php echo $main_class;?>" <?php echo WpkPageHelper::zn_schema_markup('main'); ?> <?php $blog_layout = zget_option( 'blog_layout', 'blog_options', false, 'def_classic' ); $columns = zget_option( 'blog_style_layout', 'blog_options', false, '1' ); if ( $blog_layout == 'cols' && in_array( $columns, array(1, 2, 3, 4, 5, 6) ) ) { get_template_part( 'blog', 'columns' ); } elseif ( $blog_layout == 'def_classic' || $blog_layout == 'def_modern' ) { get_template_part( 'blog', 'default' ); } ?> </div><!--// #th-content-archive --> <?php get_sidebar(); ?> </div> </div> </section><!--// #content --> <?php get_footer();
код файла blog-default.php
<?php if(! defined('ABSPATH')){ return; } global $hasSidebar, $zn_config, $current_post; // Check if PB Element has style selected, if not use Blog style option. If no blog style option, use Global site skin. $blog_style_global = zget_option( 'blog_style', 'blog_options', false, '' ) != '' ? zget_option( 'blog_style', 'blog_options', false, '' ) : zget_option( 'zn_main_style', 'color_options', false, 'light' ); $blog_style = isset($zn_config['blog_style']) && $zn_config['blog_style'] != '' ? $zn_config['blog_style'] : $blog_style_global; $blog_layout = isset($zn_config['blog_layout']) && $zn_config['blog_layout'] != '' ? $zn_config['blog_layout'] : zget_option( 'blog_layout', 'blog_options', false, 'def_classic' ); $sb_archive_content_type = zget_option( 'sb_archive_content_type', 'blog_options', false, 'full' ); $classes = array(); $classes[] = 'itemListView eBlog kl-blog kl-blog-list-wrapper kl-blog--default clearfix'; $classes[] = 'kl-blog--style-'.$blog_style; $classes[] = 'element-scheme--'.$blog_style; $classes[] = 'kl-blog--layout-'.$blog_layout; $classes[] = 'kl-blog-content-'.$sb_archive_content_type; ?> <div class="<?php echo implode(' ', $classes); ?>" <?php echo WpkPageHelper::zn_schema_markup('blog'); ?>> <?php the_archive_description( '<div class="kl-blog-taxonomy-description">', '</div>' ); ?> <div class="itemList kl-blog-list "> <?php if ( have_posts() ) : while ( have_posts() ) { the_post(); /** * Get generic blog layout/style * @since v4.0.12 */ include(locate_template( 'components/blog/blog-default-' . $blog_layout . '.php')); } else: /** * No posts message * @since v4.0.12 */ include(locate_template( 'components/blog/blog-noposts.php' )); endif; ?> </div> <!-- end .itemList --> <?php include(locate_template( 'components/blog/blog-pagination.php' )); ?> </div> <!-- end blog items list (.itemListView) -->
blog-default-def_modern.php
<?php if(! defined('ABSPATH')){ return; } global $hasSidebar, $zn_config, $current_post; $sb_archive_use_full_image = zget_option( 'sb_archive_use_full_image', 'blog_options', false, 'no' ); $featPostClass = is_sticky( get_the_id() ) ? 'featured-post kl-blog--featured-post' : ''; $post_format = get_post_format() ? get_post_format() : 'standard'; $current_post = zn_setup_post_data( $post_format ); // Hide Body & bottomn links side of the articles, for Links, Quote (post type articles) $hide_body = ($post_format == 'link' || $post_format == 'quote'); if(! isset($current_post['title']) || empty( $current_post['title'] ) ) { if(! is_array($current_post)){ $current_post = array(); } $current_post['title'] = get_the_title(); } if(!empty($featPostClass)) { ?> <div class=" kl-blog-item-container <?php echo $featPostClass;?> <?php echo implode ( ' ' , get_post_class('blog-post' ) ); ?>" <?php echo WpkPageHelper::zn_schema_markup('blogpost'); ?>> <?php if(empty($current_post['media'])){ echo '<div class="zn_sticky_no_image kl-blog-sticky-noimg"></div>'; } else { echo $current_post['media']; } ?> <div class="kl-blog-featured-content"> <div class="kl-blog-featured-inner"> <?php // Load item title include(locate_template( 'components/blog/default-modern/blog-title.php' )); // Load item header include(locate_template( 'components/blog/default-modern/blog-header.php' )); ?> <div class="clearfix"></div> </div> </div> </div> <?php } else { ?> <?php echo $current_post['before']; ?> <div class="kl-blog-item-container kl-blog--normal-post <?php echo implode ( ' ' , get_post_class('blog-post' ) ); ?> " <?php echo WpkPageHelper::zn_schema_markup('blogpost'); ?>> <?php echo $current_post['before_head']; /** * Layout for FULL image */ if( $sb_archive_use_full_image == 'yes' ){ $item_head_start = ''; $item_head_end = ''; if(!empty($current_post['media'])){ $item_head_start = '<div class="kl-blog-item-head-wrapper">'; $item_head_end = '</div>'; } echo $item_head_start; echo $current_post['media']; // Load item header include(locate_template( 'components/blog/default-modern/blog-header.php' )); echo $item_head_end; // Load item title include(locate_template( 'components/blog/default-modern/blog-title.php' )); } /** * Layout for normal fixed width image */ elseif( $sb_archive_use_full_image == 'no' ){ // Load item title include(locate_template( 'components/blog/default-modern/blog-title.php' )); // Load item Header include(locate_template( 'components/blog/default-modern/blog-header.php' )); echo $current_post['media']; } echo $current_post['after_head']; if(!$hide_body): ?> <div class="kl-blog-item-body clearfix"> <?php // Load item image include(locate_template( 'components/blog/default-modern/blog-img.php' )); // Load item footer include(locate_template( 'components/blog/default-modern/blog-footer.php' )); ?> </div> <?php endif; ?> </div><!-- end Blog Item --> <?php } ?> <div class="clearfix"></div>
<?php if(! defined('ABSPATH')){ return; } /** * Template layout for DOCUMENTATION ARCHIVES * @package Kallyas * @author Team Hogash */ wp_enqueue_style( 'documentation-css', THEME_BASE_URI . '/css/pages/documentation.css', array('kallyas-styles'), ZN_FW_VERSION ); get_header(); //** Put the header with title and breadcrumb get_template_part( 'components/theme-subheader/subheader', 'documentation' ); global $wp_query; ?> <section id="content" class="site-content" <?php echo WpkPageHelper::zn_schema_markup('main'); ?>> <div class="container"> <div class="row"> <div class="zn_doc_breadcrumb fixclear"> <span><?php _e("YOU ARE HERE:",'zn_framework'); ?></span> <span><a href="<?php echo get_site_url(); ?>"><?php _e("HOME",'zn_framework'); ?></a> > </span> <?php if ( is_tax('documentation_category') ) { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $parents = array(); $parent = $term->parent; while ( $parent ) { $parents[] = $parent; $new_parent = get_term_by( 'id', $parent, get_query_var( 'taxonomy' ) ); $parent = $new_parent->parent; } if ( ! empty( $parents ) ) { $parents = array_reverse( $parents ); foreach ( $parents as $parent ) { $item = get_term_by( 'id', $parent, get_query_var( 'taxonomy' )); echo '<span><a href="' . get_term_link( $item->slug, 'documentation_category' ) . '">' . $item->name . '</a></span>'; } } $queried_object = $wp_query->get_queried_object(); echo '<span>'. $queried_object->name . '</span>'; } ?> </div> <div class="clearfix"></div> <div class="itemListView clearfix eBlog kl-blog kl-blog-list-wrapper kl-blog--style-<?php echo zget_option( 'zn_main_style', 'color_options', false, 'light' ); ?>"> <div class="itemList kl-blog-list kl-blog--default"> <?php if ( have_posts() ) { while ( have_posts() ) { the_post(); ?> <div class="itemContainer kl-blog-item-container post-<?php the_ID(); ?>"> <div class="itemHeader kl-blog-item-header"> <h3 class="itemTitle kl-blog-item-title" <?php echo WpkPageHelper::zn_schema_markup('title'); ?>> <a href="<?php the_permalink(); ?>" class="kl-blog-item-title-link"><?php the_title();?></a> </h3> </div> <!-- end itemHeader --> <div class="itemBody kl-blog-item-body"> <div class="itemIntroText kl-blog-item-content"> <?php the_excerpt(); ?> </div> <!-- end Item Intro Text --> <div class="clearfix"></div> <div class="itemReadMore kl-blog-item-more"> <a class="readMore kl-blog-item-more-btn btn btn-fullcolor text-uppercase" href="<?php the_permalink(); ?>"> <?php echo __( 'Read more...', 'zn_framework' );?> </a> </div> <!-- end read more --> <div class="clearfix"></div> </div> <!-- end Item BODY --> <div class="clearfix"></div> </div><!-- end Blog Item --> <div class="clearfix"></div> <?php } } else { ?> <div class="itemContainer noPosts kl-blog-item-container kl-blog-item--noposts"> <p><?php echo __('Sorry, no posts matched your criteria.', 'zn_framework' ); ?></p> </div><!-- end Blog Item --> <div class="clearfix"></div> <?php } //endif ?> </div><!-- end .itemList --> <!-- Pagination --> <?php echo '<div class="pagination--'.zget_option( 'zn_main_style', 'color_options', false, 'light' ).'">'; zn_pagination(); echo '</div>'; ?> </div><!-- end blog items list (.itemListView) --> </div> </div><!-- end container --> </section><!-- end content --> <?php get_footer(); ?>
если вы скинули код файла который отвечает за вывод архива публикаций, то мне не понятно, почему функция the_excerpt не добавляет данные задания, тк эти данные добавляются через стандартный фильтр the_excerpt.
Можете попробовать разместить вывод данных задания вручную в коде приведенного шаблона, используйте такой код:
if($post_type == 'task') echo rcl_get_task_metadata();
Вставлял по разному
и выше и ниже и в цикл архива
сейчас стоит так
?> <section class="site-content"> <div class="container"> <div class="row"> <div id="th-content-archive" class="" > 'task')); ?> if($post_type == 'task') echo rcl_get_task_metadata(); </div><!--// #th-content-archive --> </div> </section><!--// #content --> <?php get_footer();
что то сдвинулось все
повтор
?> <section id="content" class="site-content" > <div class="container"> <div class="row"> <div id="th-content-archive" class="<?php echo $main_class;?>" <?php echo WpkPageHelper::zn_schema_markup('main'); ?>> <?php if(is_post_type_archive('task')||is_tax('task-subject')) get_freelance_task_filter(); ?> <?php query_posts(array('post_type'=>'task')); ?> if($post_type == 'task') echo rcl_get_task_metadata(); <?php $blog_layout = zget_option( 'blog_layout', 'blog_options', false, 'def_classic' ); $columns = zget_option( 'blog_style_layout', 'blog_options', false, '1' ); if ( $blog_layout == 'cols' && in_array( $columns, array(1, 2, 3, 4, 5, 6) ) ) { get_template_part( 'blog', 'columns' ); } elseif ( $blog_layout == 'def_classic' || $blog_layout == 'def_modern' ) { get_template_part( 'blog', 'default' ); } ?> </div><!--// #th-content-archive --> <?php get_sidebar(); ?> </div> </div> </section><!--// #content --> <?php get_footer();
сейчас исправил
но все также
?> <section id="content" class="site-content" > <div class="container"> <div class="row"> <div id="th-content-archive" class="<?php echo $main_class;?>" <?php echo WpkPageHelper::zn_schema_markup('main'); ?>> <?php if(is_post_type_archive('task')||is_tax('task-subject')) get_freelance_task_filter(); ?> <?php query_posts(array('post_type'=>'task')); ?> <?php if($post_type == 'task') echo rcl_get_task_metadata(); $blog_layout = zget_option( 'blog_layout', 'blog_options', false, 'def_classic' ); $columns = zget_option( 'blog_style_layout', 'blog_options', false, '1' ); ?> </div><!--// #th-content-archive --> <?php get_sidebar(); ?> </div> </div> </section><!--// #content --> <?php get_footer();