<?php
$args = array( 'child_of' => $current_term->term_id, 'orderby' => 'name', 'order' => 'ASC' );
$terms = get_terms( 'product_cat', $args );
$count = count($terms);
if($count > 0){
echo "<ul>";
foreach ($terms as $term) {
echo "<li>".$term->name."</li>";
}
echo "</ul>";
}
?>
<?php
add_shortcode( 'product_categories_dropdown', 'woo_product_categories_dropdown' );
function woo_product_categories_dropdown( $atts ) {
extract(shortcode_atts(array(
'count' => '1',
'hierarchical' => '1',
'orderby' => ''
), $atts));
ob_start();
$c = $count;
$h = $hierarchical;
$o = ( isset( $orderby ) && $orderby != '' ) ? $orderby : 'order';
// Stuck with this until a fix for http://core.trac.wordpress.org/ticket/13258
woocommerce_product_dropdown_categories( $c, $h, 0, $o );
?>
<script type='text/javascript'>
/* <![CDATA[ */
var product_cat_dropdown = document.getElementById("dropdown_product_cat");
function onProductCatChange() {
if ( product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value !=='' ) {
location.href = "<?php echo home_url(); ?>/?product_cat="+product_cat_dropdown.options[product_cat_dropdown.selectedIndex].value;
}
}
product_cat_dropdown.onchange = onProductCatChange;
/* ]]> */
</script>
<?php
return ob_get_clean();
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
</article>
<?php endwhile; endif; ?>
<?php global $query_string;
$posts = query_posts($query_string.'&posts_per_page=10'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
/*Содержимое страницы*/
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
function my_taxonomies_teacher() {
$labels = array(
'name' => _x( 'Teacher Categories', 'taxonomy general name' ),
'singular_name' => _x( 'Teacher Category', 'taxonomy singular name' ),
'search_items' => __( 'Search Teacher Categories' ),
'all_items' => __( 'All Teacher Categories' ),
'parent_item' => __( 'Parent Teacher Category' ),
'parent_item_colon' => __( 'Parent Teacher Category:' ),
'edit_item' => __( 'Edit Teacher Category' ),
'update_item' => __( 'Update Teacher Category' ),
'add_new_item' => __( 'Add New Teacher Category' ),
'new_item_name' => __( 'New teacher Category' ),
'menu_name' => __( 'Teacher Categories' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
);
register_taxonomy( 'teacher_category', 'teacher', $args );
}
add_action( 'init', 'my_taxonomies_teacher', 0 );