View categories.php
// in the loop
$category = get_the_category();
$currentcat = $category[0]->cat_ID;
$currentcatname = $category[0]->cat_name;
$currentcatslug = $category[0]->slug;
// outside the loop
global $post;
$categories = get_the_category($post->ID);
$currentcat = $category[0]->cat_ID;
$currentcatname = $category[0]->cat_name;
View primary-category.php
$cat = new WPSEO_Primary_Term('category', get_the_ID());
$cat = $cat->get_primary_term();
$catName = get_cat_name($cat);
$catLink = get_category_link($cat);
echo $catName;
echo $catLink;
View terms.php
$terms = get_terms("category");
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>" . $term->name . "</li>";
}
echo "</ul>";
}
View functions.php
// Remove the result count from WooCommerce
remove_action( 'woocommerce_before_shop_loop' , 'woocommerce_result_count', 20 );
View functions.php
// WooCommerce number of results select dropdown
function woocommerce_catalog_page_ordering() {
?>
<?php echo '<span class="itemsorder">Results per page:' ?>
<form action="" method="POST" name="results" class="woocommerce-ordering">
<select name="woocommerce-sort-by-columns" id="woocommerce-sort-by-columns" class="sortby" onchange="this.form.submit()">
<?php
//Get products on page reload
if (isset($_POST['woocommerce-sort-by-columns']) && (($_COOKIE['shop_pageResults'] <> $_POST['woocommerce-sort-by-columns']))) {
View tabs.php
<?php
/**
* Single Product tabs
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/tabs/tabs.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
View funtions.php
// Move Product Tabs to end of Summary
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 60 );
View conditional-single-post.php
if ( is_singular('post') ) :
// code
endif;
View featured-image.php
View functions.php
// Custom Product search
function template_chooser($template)
{
global $wp_query;
$post_type = get_query_var('post_type');
if( $wp_query->is_search && $post_type == 'product' )
{
return locate_template('search.php'); // redirect to search.php
}
return $template;