support to show static page in category archive page.
This commit is contained in:
parent
6bbfd049a2
commit
741c51d448
136
category.php
Normal file
136
category.php
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* CBSOnline category.php
|
||||||
|
*
|
||||||
|
* @package CBSOnline
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
$postType = get_post_type();
|
||||||
|
|
||||||
|
if ( !$postType ) {
|
||||||
|
global $wp_query;
|
||||||
|
if ($wp_query->query_vars['post_type']) {
|
||||||
|
$postType = $wp_query->query_vars['post_type'];
|
||||||
|
}
|
||||||
|
} ?>
|
||||||
|
<!-- [ #container ] -->
|
||||||
|
<div id="container" class="innerBox clearfix">
|
||||||
|
<!-- [ #content ] -->
|
||||||
|
<div id="content" class="content">
|
||||||
|
|
||||||
|
<div class="bcnlist">
|
||||||
|
<?php if(function_exists('bcn_display'))
|
||||||
|
{
|
||||||
|
bcn_display();
|
||||||
|
}?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
/* Archive title
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
if ( is_year()) {
|
||||||
|
// $archiveTitle = get_the_date('Y');
|
||||||
|
$archiveTitle = sprintf( __( 'Yearly Archives: %s', 'bizvektor-global-edition' ), get_the_date( _x( 'Y', 'yearly archives date format', 'bizvektor-global-edition' ) ) );
|
||||||
|
} else if ( is_month() ) {
|
||||||
|
$archiveTitle = sprintf( __( 'Monthly Archives: %s', 'bizvektor-global-edition' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'bizvektor-global-edition' ) ) );
|
||||||
|
} else if ( is_category() || is_tax() ) {
|
||||||
|
$archiveTitle = single_term_title( '',false);
|
||||||
|
} else if ( is_tag() ) {
|
||||||
|
$archiveTitle = __('Tags : ', 'bizvektor-global-edition').single_term_title( '',false);
|
||||||
|
} else if ( is_author() ) {
|
||||||
|
$userObj = get_queried_object();
|
||||||
|
$archiveTitle = $userObj->display_name;
|
||||||
|
}
|
||||||
|
if ( isset($archiveTitle) && $archiveTitle ) {
|
||||||
|
$archiveTitle = apply_filters( 'biz_vektor_archiveTitCustom', $archiveTitle );
|
||||||
|
echo '<h1 class="contentTitle">'.esc_html( $archiveTitle ).'</h1>';
|
||||||
|
}
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
/* Archive description
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
if ( is_category() || is_tax() || is_tag() ) {
|
||||||
|
$category_description = term_description();
|
||||||
|
$page = get_query_var( 'paged', 0 );
|
||||||
|
if ( ! empty( $category_description ) && $page == 0 ) {
|
||||||
|
echo '<div class="archive-meta">' . $category_description . '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
// append static page
|
||||||
|
if (!is_year() && !is_month() && !is_author()) {
|
||||||
|
$tax_slug = $wp_query->get_queried_object();
|
||||||
|
$post = get_page_by_path('category-'.esc_html($tax_slug->slug));
|
||||||
|
if ($post) {
|
||||||
|
?>
|
||||||
|
<div class="categoryEntry">
|
||||||
|
<?php
|
||||||
|
$content = apply_filters( 'the_content', $post->post_content);
|
||||||
|
echo str_replace(']]>', ']]>', $content);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<hr class="gradient" />
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
/* Archive post list
|
||||||
|
/*-------------------------------------------*/
|
||||||
|
?>
|
||||||
|
<div class="infoList">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$options = biz_vektor_get_theme_options();
|
||||||
|
|
||||||
|
if (is_biz_vektor_archive_loop()) : ?>
|
||||||
|
|
||||||
|
<?php biz_vektor_archive_loop(); ?>
|
||||||
|
|
||||||
|
<?php elseif ( apply_filters( 'biz_vektor_index_loop_hack', false ) ): ?>
|
||||||
|
|
||||||
|
<?php ///--- doing extra function ---/// ?>
|
||||||
|
|
||||||
|
<?php elseif (file_exists(get_template_directory( ).'/module_loop_'.$post_type.'.php')): ?>
|
||||||
|
|
||||||
|
<?php while ( have_posts() ) : the_post(); ?>
|
||||||
|
|
||||||
|
<?php get_template_part('module_loop_'.$post_type); ?>
|
||||||
|
|
||||||
|
<?php endwhile; ?>
|
||||||
|
|
||||||
|
<?php else : ?>
|
||||||
|
|
||||||
|
<?php $options = biz_vektor_get_theme_options();
|
||||||
|
if ( $options['listBlogArchive'] == 'listType_set' ) { ?>
|
||||||
|
<?php while ( have_posts() ) : the_post(); ?>
|
||||||
|
<?php get_template_part('module_loop_post2'); ?>
|
||||||
|
<?php endwhile ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<ul class="entryList">
|
||||||
|
<?php while ( have_posts() ) : the_post(); ?>
|
||||||
|
<?php get_template_part('module_loop_post'); ?>
|
||||||
|
<?php endwhile; ?>
|
||||||
|
</ul>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php endif; // $postType == 'info' ?>
|
||||||
|
<?php biz_vektor_pagination(); ?>
|
||||||
|
</div><!-- [ /.infoList ] -->
|
||||||
|
</div>
|
||||||
|
<!-- [ /#content ] -->
|
||||||
|
|
||||||
|
<!-- [ #sideTower ] -->
|
||||||
|
<div id="sideTower" class="sideTower side">
|
||||||
|
<?php get_sidebar($postType); ?>
|
||||||
|
</div>
|
||||||
|
<!-- [ /#sideTower ] -->
|
||||||
|
<?php biz_vektor_sideTower_after();?>
|
||||||
|
</div>
|
||||||
|
<!-- [ /#container ] -->
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
11
style.css
11
style.css
@ -298,3 +298,14 @@ form#searchform input#searchsubmit {
|
|||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* category page */
|
||||||
|
#content hr.gradient {
|
||||||
|
margin: 2em 0;
|
||||||
|
border: 0;
|
||||||
|
height: 1px;
|
||||||
|
background-image: linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -webkit-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -moz-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -ms-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
background-image: -o-linear-gradient(left, #f0f0f0, #8c8b8b, #f0f0f0);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user