function get_blog_sub_cats_str($type = 'array') { $catid = get_inc_categories("cat_exclude_"); $catid_arr = explode(',', $catid); $blogcatids = ''; $subcatids_arr = array(); for ($i = 0; $i < count($catid_arr); $i++) { if ($catid_arr[$i]) { $subcatids_arr = array_merge($subcatids_arr, array($catid_arr[$i]), get_term_children($catid_arr[$i], 'category')); } } if ($subcatids_arr && $type == 'string') { $blogcatids = implode(',', $subcatids_arr); return $blogcatids; } else { return $subcatids_arr; } }
/images/spacer.png" alt="" class="arrow" /> <?php _e('Ver Detalhes'); ?> </a></p> </div> <!-- featured pro #end --> <h3><?php _e('Our Products'); ?> </h3> <ul> <?php $ex_catIdArr = get_categories('exclude=9999999' . get_inc_categories("cat_exclude_") . ',1'); $catIdArr = array(); foreach ($ex_catIdArr as $ex_catIdArrObj) { $catIdArr[] = $ex_catIdArrObj->term_id; } $includeCats = implode(',', $catIdArr); wp_list_categories('orderby=name&title_li=&include=' . $includeCats); ?> </ul> <?php if (function_exists('dynamic_sidebar')) { // Show on the front page ?> <?php dynamic_sidebar('Front Page Sidebar Left'); ?>
function widget($args, $instance) { // prints the widget global $Cart, $General, $Product, $post; extract($args, EXTR_SKIP); echo $before_widget; if ($before_title == '' || $after_title == '') { $before_title == '<h4>'; $after_title == '</h4>'; } $title = empty($instance['title']) ? __('Latest Products') : apply_filters('widget_category', $instance['title']); $display_prds_no = empty($instance['display_prds_no']) ? 10 : apply_filters('widget_category', $instance['display_prds_no']); $list_type = empty($instance['display_prds_no']) ? 'Grid' : apply_filters('widget_category', $instance['list_type']); $show_store_link = empty($instance['show_store_link']) ? '' : apply_filters('widget_category', $instance['show_store_link']); $image_width = empty($instance['image_width']) ? '' : apply_filters('widget_image_width', $instance['image_width']); $image_height = empty($instance['image_height']) ? '' : apply_filters('widget_image_height', $instance['image_height']); ?> <h3 class="title"><?php echo $title; ?> </h3> <?php if (have_posts()) { $limit = $display_prds_no; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $blogCategoryIdStr = str_replace(',', ',-', get_inc_categories("cat_exclude_")); query_posts('showposts=' . $limit . '&paged=' . $paged . '&cat=' . $blogCategoryIdStr); ?> <ul style="display: block;" class="display <?php if ($list_type == 'Grid') { echo 'thumb_view'; } ?> category_list"> <?php while (have_posts()) { the_post(); $post->image_width = $image_width; $post->image_height = $image_height; $Product->product_listing_li($post); } ?> </ul> <div class="clearfix"></div> <?php } ?> <?php if ($show_store_link) { $General->view_store_link_home(); } ?> <?php echo $after_widget; }
function product_filter_join($join) { global $wpdb; $blogCategoryIdStr = get_inc_categories("cat_exclude_"); $blogCategoryIdStr_arr = explode(',', $blogCategoryIdStr); for ($i = 0; $i < count($blogCategoryIdStr_arr); $i++) { if ($blogCategoryIdStr_arr[$i]) { $blogCategoryIdStr_arr1[] = $blogCategoryIdStr_arr[$i]; } } if ($blogCategoryIdStr_arr1) { $blogCategoryIdStr = implode(',', $blogCategoryIdStr_arr1); } $blog_posts = ''; $blog_posts = $wpdb->get_var("SELECT group_concat(tr.object_id) FROM {$wpdb->term_taxonomy} tt join {$wpdb->term_relationships} tr on tr.term_taxonomy_id=tt.term_taxonomy_id where tt.term_id in ({$blogCategoryIdStr})"); if ($_REQUEST['ptype'] == 'prd' && $blog_posts != '') { $join .= " and {$wpdb->posts}.ID not in ({$blog_posts})"; } return $join; }
<?php $blogCategoryIdStr = get_inc_categories("cat_exclude_"); $blogCategoryIdArr = explode(',', $blogCategoryIdStr); if (have_posts()) { while (have_posts()) { the_post(); $cagInfo = get_the_category(); $postCatId = $cagInfo[0]->term_id; if (!in_array($postCatId, $blogCategoryIdArr)) { include TEMPLATEPATH . '/library/includes/product_detail.php'; } else { if (CHILDTEMPLATEPATH && file_exists(CHILDTEMPLATEPATH . '/library/includes/blog_detail.php')) { include CHILDTEMPLATEPATH . '/library/includes/blog_detail.php'; } else { include TEMPLATEPATH . '/library/includes/blog_detail.php'; } } } }
<?php /* Template Name: Store Page */ $totalpost_count = 0; $limit = 1000; $blogCategoryIdStr = str_replace(',', ',-', get_inc_categories("cat_exclude_")); query_posts('showposts=' . $limit . '&cat=' . $blogCategoryIdStr); if (have_posts()) { while (have_posts()) { the_post(); $totalpost_count++; } } //echo $totalpost_count; if (get_option('ptthemes_storeprd_number')) { $limit = get_option('ptthemes_storeprd_number'); } else { $limit = 16; } // number of posts per page for store page $posts_per_page_homepage = $limit; global $paged; $blogCategoryIdStr = str_replace(',', ',-', get_inc_categories("cat_exclude_")); query_posts('showposts=' . $limit . '&paged=' . $paged . '&cat=' . $blogCategoryIdStr); include TEMPLATEPATH . '/library/includes/store.php';