wordpress-theme-cbsonline/category.php

148 lines
4.1 KiB
PHP

<?php
/**
* CBSOnline category.php
*
* @package CBSOnline
* @version 1.0.0
*/
global $wp_query;
$tax_slug = $wp_query->get_queried_object();
$isNoSideBar = 'online-bsss' === $tax_slug->slug;
$lang = get_query_var('lang', '');
if ($tax_slug->slug === 'online-bsss' && $lang === 'ja') {
$url = site_url('/online-bsss');
wp_safe_redirect($url, 301);
exit;
}
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<?php echo $isNoSideBar ? ' wide' : ''; ?>">
<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()) {
$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(']]>', ']]&gt;', $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 ] -->
<?php if (!$isNoSideBar) : ?>
<!-- [ #sideTower ] -->
<div id="sideTower" class="sideTower side">
<?php get_sidebar($postType); ?>
</div>
<!-- [ /#sideTower ] -->
<?php biz_vektor_sideTower_after();?>
<?php endif; ?>
</div>
<!-- [ /#container ] -->
<?php get_footer(); ?>