How to add location as category?

Ok, based on what you wrote in your comments you’ll want to go to your wp-content/plugins/ directory and create a new directory in there. Let’s call it: zains-locations. In that directory, make a new file called: zains-locations.php In that file, add the following: <?php /* Plugin Name: Zain’s Location Taxonomy Description: Add’s location taxonomy. Version: … Read more

Why does my category page display “posted on…” when all I want it to do is display categories?

Open the archive.php file of the Blank theme and delete this code from the top. <?php /* If this is a category archive */ if (is_category()) { ?> <h2>Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h2>Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2> … Read more

Display category tree of a post in search results

i am missing some details but here is the code for this string “category level 1-> level 2 -> level3″… i also included the search term as the title and the loop around it.. <h1><?php echo ‘Search Results For:’. get_search_query(); ?></h1> <ul> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php $category = get_the_category(); … Read more

How to Organize my Photo Albums?

General idea based on the use of regular Posts, not Custom Post Types (which is what the plugin CPT-UI is about): one parent Category -Photos under it, the needed sub-categories -Personal, Professional, etc one post corresponds to one Album -Vacations 2012, News Coverage, etc upload all images of the Album into the post, put titles, … Read more

WooCommerce Product Search Error

” Invalid argument supplied for foreach()” . means that the $parents variable is not an array so you can’t loop through it. You should wrap the foreach loop in an if check that verifies that $parents is something valid. <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); $parents = get_the_terms($term->parent, get_query_var(‘taxonomy’) … Read more