再会。
我正在使用一个有投资组合的主题。投资组合当前显示列出的所有类别。如何将其更改为仅显示某些类别,即。设计和图像?
这是投资组合模板页面的代码
<?php
/*
Template Name: Portfolio page
*/
?>
<?php get_header(); ?>
<?php
global $wp_query;
$post = $wp_query->post;
$gogo_select_portfolio_cat = get_post_meta($post->ID, 'gogo_select_portfolio_cat', true);
$gogo_portfolio_items_order = get_post_meta($post->ID, 'gogo_portfolio_items_order', true);
$gogo_portfolio_text_no_posts = get_post_meta($post->ID, 'gogo_portfolio_text_no_posts', true);
$gogo_select_portfolio_template = get_post_meta($post->ID, 'gogo_select_portfolio_template', true);
$gogo_select_portfolio_sidebar_position = get_post_meta($post->ID, 'gogo_select_portfolio_sidebar_position', true);
?>
<div class="block clearfix">
<header class="box-headline">
<h4 class="main-headline"><?php the_title(); ?></h4>
</header>
<?php if ($gogo_select_portfolio_template=='portfolio-fourthcol') {
load_template(TEMPLATEPATH . '/lib/includes/portfolio/portfolio-4col.php');
} ?>
<?php if ($gogo_select_portfolio_template=='portfolio-threecol') {
load_template(TEMPLATEPATH . '/lib/includes/portfolio/portfolio-3col.php');
} ?>
<?php if ($gogo_select_portfolio_template=='portfolio-twocol') {
load_template(TEMPLATEPATH . '/lib/includes/portfolio/portfolio-2col.php');
} ?>
</div>
<?php get_footer();?>.
Portfolio-4col.php 内容:
<ul id="filterOptions" class="horizontal" data-option-key="filter">
<li><a class="selected" href="#filter" data-option-value="*">Show all</a></li>
<?php
$categories= get_categories('taxonomy=portfolio_cat&title_li=');
foreach ($categories as $category){ ?>
<li><a href="#filter" data-option-value=".<?php echo $category->slug;?>" title="Filter by <?php echo $category->name;?>"><?php echo $category->name;?></a></li>
<?php }?>
</ul>
<ul class="isotope-holder horizontal four-columns">
<?php rewind_posts(); ?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts( array(
'post_type' => 'portfolio',
'posts_per_page' => -1,
'ignore_sticky_posts' => 1
)
);
$postcount = 0;
if ( have_posts() ) : while ( have_posts() ) : the_post(); $postcount++;?>
<!--Retrieve posts meta from custom post types -->
<?php
$gogo_portfolio_short_desc = get_post_meta($post->ID, 'gogo_portfolio_short_desc', true);
$gogo_portfolio_video_url = get_post_meta($post->ID, 'gogo_portfolio_video_url', true);
$gogo_portfolio_custom_link = get_post_meta($post->ID, 'gogo_portfolio_custom_link', true);
$gogo_portfolio_display_image_link = get_post_meta($post->ID, 'gogo_portfolio_display_image_link', true);
$gogo_portfolio_display_article_link = get_post_meta($post->ID, 'gogo_portfolio_display_article_link', true);
$gogo_portfolio_display_external_link = get_post_meta($post->ID, 'gogo_portfolio_display_external_link', true); ?>
<li class="element <?php $terms = wp_get_post_terms($post->ID,'portfolio_cat'); foreach ($terms as $term) { echo ' ' .$term->slug. ' '; } ?>">
<div class="view view-sixth">
<?php if (has_post_thumbnail()) { ?>
<figure>
<?php $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
echo '<img src="'.get_template_directory_uri().'/timthumb.php?src='.$thumbnail[0].'&w=218&h=200&zc=1&q=100&s=1" alt="'.get_the_title().'" />';?>
</figure>
<?php } ?>
<div class="mask">
<header class="box-headline">
<?php echo '<h4><a href="'.get_permalink().'">'; echo ''.get_the_title().''; echo '</a></h4>'; ?>
</header>
<div class="content">
<p><?php echo $gogo_portfolio_short_desc; ?></p>
<a href="<?php echo get_permalink(); ?>" class="info"><span>Read More »</span></a>
</div>
</div>
</div>
</li>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</ul>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(window).load(function() {
var $jcontainer = $j('ul.isotope-holder');
$jcontainer.isotope({
itemSelector : '.element',
resizable: false, // disable normal resizing
// set columnWidth to a percentage of container width
masonry: { columnWidth: $jcontainer.width() / 4 }
});
// update columnWidth on window resize
$j(window).smartresize(function(){
$jcontainer.isotope({
// update columnWidth to a percentage of container width
masonry: { columnWidth: $jcontainer.width() / 4}
});
});
var $joptionSets = $j('#filterOptions'),
$joptionLinks = $joptionSets.find('a');
$joptionLinks.click(function(){
var $jthis = $j(this);
// don't proceed if already selected
if ( $jthis.hasClass('selected') ) {
return false;
}
var $joptionSet = $jthis.parents('#filterOptions');
$joptionSet.find('.selected').removeClass('selected');
$jthis.addClass('selected');
// make option object dynamically, i.e. { filter: '.my-filter-class' }
var options = {},
key = $joptionSet.attr('data-option-key'),
value = $jthis.attr('data-option-value');
// parse 'false' as false boolean
value = value === 'false' ? false : value;
options[ key ] = value;
if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
// changes in layout modes need extra logic
changeLayoutMode( $jthis, options )
} else {
// otherwise, apply new options
$jcontainer.isotope( options );
}
return false;
});
});
</script>
任何帮助将不胜感激
谢谢