Creating gallery with taxonomy images plugin?

Change the second line of your code to this: $catlist = get_categories( ‘hide_empty=0&parent=” . $cat_id ); Instead of child_of parameter, use the parent parameter of the get_categories() function; this will display the direct descendants (i.e. children only) of the category and not grandchildren of the category. For more information visit the Codex page for get_categories().

get_the_category_list open in parent window

get_the_category_list runs it output through the filter the_category. You could hook in there and change whatever you like. Something like this should work (untested): <?php add_filter(‘the_category’, ‘wpse90955_the_category’); function wpse90955_the_category($cat_list) { return str_ireplace(‘<a’, ‘<a target=”_parent”‘, $cat_list); } If you just need to have that list filter in certain spots, you can define the function above in … Read more

Customized landingpages for categories

Here is the Template Hierarchy, which gives you an overview of the different approaches. You could create for each category an individual PHP file: either category-{CATEGORY ID}.php or category-{CATEGORY SLUG}.php. Or you could use a single file category.php in which you define the output (as well as its layout, style etc.) according to the current … Read more

Resort get_categories

There is already a function in WordPress doing that: wp_terms_checklist(). It is used in the metabox for hierarchical taxonomies in the post editor. Maybe you can reuse that? The following is untested, see it just as a guide please, not as a complete solution: // File where “wp_terms_checklist()” is declared require_once ABSPATH . ‘wp-admin/includes/template.php’; // … Read more

How to query post like normal search would do. within search.php page

This is what i did: I run another query without pagination like this: $newQuaryVars=”&posts_per_page=99999999999999&post_type=post”; $posts = query_posts($query_string .$newQuaryVars); $categoriesList = array(); $categoriesAmounts = array(); Then in the while have posts i did the following: while ( have_posts() ) : the_post(); $postCategories = get_the_category(); if($postCategories){ foreach($postCategories as $categoryInfo) { $categoriesAmounts[$categoryInfo->term_id][‘amount’]++; $categoriesList[$categoryInfo->term_id] = array( ‘name’ => $categoryInfo->name, … Read more

Adding Categories Through Function

Themes do not have an equivalent of register_activation_hook() like plugins. You may also run into issues during a review if you’re hoping to be hosted on the repo. I’m not sure how creating categories classifies exactly, but doing things like creating post types is explicitly disallowed. That said, you can use wp_create_category() in your functions.php … Read more

Highlight wp_nav_menu when category is selected

one solution to your problem using jQuery( put this code in functions.php ) <?php add_action(‘wp_footer’,’ravs_browse_menu’); function ravs_browse_menu(){ if(isset($_GET[‘cat’]) && $_GET[‘cat’] !=”){ ?> <script> jQuery(document).ready(function(){ jQuery(‘#menu-item-299’).addClass(‘current-menu-item’); }); </script> <?php } } ?>

get_the_categories filter returns an empty array

Changes occur when a filter is applied, but’s that’s not where the rules for the alteration originate from. Either your theme or a plugin you are using must be hooking into that filter and be adding a callback function/method, that is responsible for the $categories array being emptied. Deactivate all plugins, switch to a standard … Read more