Widely theme – Removing "All" category from the Portfolio
-
Hello,
I spent two days searching a solution for this question. I have a few categories on the webpage and a general category with name “All”, which displays all the posts from the other categories, but I need to hide “All” from the webpage and set, for example, a “Public” category by default (http://www.retlar.ee).
I found that developer of Widely used Quicksand as a base and modified it for Widely theme. All solutions, which already posted on the web, do not suitable for this specific theme.
I am not very powerful in PHP and JavaScript, so I did not find a solution and need your help.I have 3.4.2 WordPress.
Portfolio page source:
<?php get_header();
/*Template Name: Portfolio
*/
?><div class="title-line">
<span class="page-title-text more-padd"><?php echo the_title();?></span><div class="title-width-line"></div>
<div class="clear-both"></div>
</div><div id="wraper-inside">
<div id="wraper-holder-wide">
<?php
if(isset($_SESSION['showlineforportfolio'])) {
$_SESSION['showlineforportfolio']
?>
<div id="horizontal-line" class="horizontal-line-wide"></div>
<?php
}
?>
<!-- CATEGORY PRINT -->
<div class="portfolio-cat-holder">
<img alt="category image" class="cat-img" src="<?php echo get_template_directory_uri(); ?>/style/img/categories.png" />
<ul id="filter">
<li class="cat_cell" style="display:none;" data-filter="all" >All
<?phpwp_reset_query();
$portfolio_category = get_option(THEME_NAME.'_portfolio_include_category');
/*CATEGORY INCLUDE OR EXCLUDE: ('orderby=name&include=9')*/
$categories = get_categories('orderby=name');
$include_category = null;
$slug = get_page_link();
foreach ($categories as $category_list) {
$showall = 0;
if($showall == 1) {
if(!empty($portfolio_category[0][$category_list->cat_ID])) {
$cat = $category_list->cat_ID.",";
$include_category = $include_category.$cat;
echo '<li class="cat_cell" data-filter="'.$category_list->cat_ID.'">'.$category_list->cat_name.'';
}}else {
$add = 1;
if(!empty($portfolio_category[0][$category_list->cat_ID])) {
$args=array('cat'=>$category_list->cat_ID, 'post_status' => 'publish','meta_key' => '_thumbnail_id'); /*meta key zadajot pic*/
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post();if (has_post_thumbnail()) {
$imagedata = simplexml_load_string(get_the_post_thumbnail());
$post_img = $imagedata->attributes()->src;
if(!empty($post_img)) {
$add = 1;
}
}
endwhile;?>
<?php else :
echo '<img src="' . get_bloginfo('template_directory') . '/images/no-image.png' . '" width="" height="" alt="thumbnail" />';endif;
if($add == 1) {
$include_category = $include_category.$cat;
echo $include_category;
echo '<li class="cat_cell" data-filter="'.$category_list->cat_ID.'">-'.$category_list->cat_name.'';
}
}
}
}?></div>
<!-- /CATEGORY PRINT --><script type="text/javascript">
jQuery(document).ready(function($){
var $data = $("#portfolio-holder").clone();
$('#filter li').click(function(e) {
$('#portfolio-holder').css('height','800px');
var filterClass=$(this).attr('data-filter');/*
if (filterClass == 'all') {
var $filteredData = $data.find('.portfolio_box');
} else {
var $filteredData = $data.find('.portfolio_box[data-type=' + filterClass + ']');
}
*/
var $filteredData = $data.find('.portfolio_box[data-type=' + filterClass + ']');$("#portfolio-holder").quicksand($filteredData, {
duration: 400,
easing: 'swing',
adjustHeight: 'false'
},function(){
$('#portfolio-holder').css('height','auto');
$('.fancybox-overlay,.fancybox-wrap,.fancybox-loading,.fancybox-tmp').remove();
jQuery('.fancybox').fancybox();
});jQuery('img','.pirobox').live({
mouseenter:
function()
{
jQuery(this).stop().animate({opacity:0.4},500);
},
mouseleave:
function()
{
jQuery(this).stop().animate({opacity:1},300);
}
}
);
return false;
});
});</script>
<div id="portfolio-holder-relative">
<div id="portfolio-holder" >
<?php
wp_reset_query();foreach ($portfolio_category[0] as $x => $y) {
if(!isset($categories_for_queue)) {
$categories_for_queue = $x;
}else {
$categories_for_queue .= ','.$x;
$categories_for_queue = $x;
}
}$numportfolio = get_option(THEME_NAME.'_number_of_images_portfolio');
$url = get_page_url();
$showall = get_option(THEME_NAME.'_show_without_images_portfolio');
echo $showall;
if(!isset($showall) || $showall !== 1) {
$args=array('cat'=>$categories_for_queue, 'post_status' => 'publish','posts_per_page' => 300 ,'meta_key' => '_thumbnail_id');
query_posts($args);
}$i=0;
$z=1;
if ( have_posts() ) : while ( have_posts() ) : the_post();
if (has_post_thumbnail()) {
$imagedata = simplexml_load_string(get_the_post_thumbnail());
$post_img = $imagedata->attributes()->src;
}else {
$post_img = "";
}
$i++;
foreach(get_the_category() as $category) {
$cat = $category->cat_ID." ";
}
$trimmed = trim($cat);
?><div class="portfolio_box <?php echo $cat;?> portfolio_box_one portfolio_box-3colSimple" data-type="<?php echo $trimmed; ?>" data-id="box-<?php echo $i; ?>" >
<p class="portfolioList">
<?php
$thetitle = get_the_title();
echo ($thetitle);?>
</p>
</div>
<?php
$z++;
endwhile; ?>
<?php else: ?>
<?php endif; ?>
</div><!-- Gallery -->
<div class="rigth_col">
<?php
echo do_shortcode('[nggallery id=4 w=auto h=auto]');
?></div>
<!-- /Gallery -->
</div></div>
</div>
<div class="clear-both"></div><?php get_footer(); ?>
- The topic ‘Widely theme – Removing "All" category from the Portfolio’ is closed to new replies.