Child Category Conditional Question

I don’t know what is_category_or_sub() and that function is the critical piece of code. Without it, the question of why your code doesn’t work isn’t answerable but there is code in the Codex that seems to do what you need: /** * Tests if any of a post’s assigned categories are descendants of target categories … Read more

How to remove the tilte “category:category name”?

You need to find the according template file in the template hierarchy for the category archive, which would be, in this order, either one of those: category-{slug}.php category-{id}.php category.php archive.php index.php There you can get rid of the »Category:« part. To define the width of your content change the CSS accordingly.

Illegal string offset ‘taxonomy’ in

Most likely the problem comes from: $terms = get_the_terms( $post->ID, $args[‘taxonomy’] ); i.e. you have to make sure it’s not false or WP_Error object. You should also check the output of: var_dump( $args ); Try for example: if( ! is_array( $terms ) ) return $output; or if( ! $terms || is_wp_error( $terms ) ) return $output; … Read more

Display subcategories in dropdown

You can use a similar block of code to display the categories in a dropdown. I have picked the following example from WordPress codex article on get_categories(): <select name=”event-dropdown” onchange=”document.location.href=this.options[this.selectedIndex].value;”> <option value=””><?php echo esc_attr(__(‘Select Event’)); ?></option> <?php $categories = get_categories(‘child_of=10’); foreach ($categories as $category) { $option = ‘<option value=”/category/blog/’.$category->category_nicename.'”>’; $option .= $category->cat_name; $option .= ‘ … Read more

Getting Category Children

The child_of parameter excepts an integer value of the specific term you need to get descendants from. This means that you need to get the ID from the On-going category term and then passing that ID to the child_of parameter. To note, the child_of parameter returns all descendants of the term passed, this includes direct … Read more

Custom row actions on a specific category

// remove the delete link for the specific category function category_row_actions( $actions, $tag ) { if ( $tag->term_id == PROTECTED_TERM_ID ) unset( $actions[‘delete’] ); return $actions; } // create the category if not excists (in case it’s removed again in another theme) if (file_exists (ABSPATH.’/wp-admin/includes/taxonomy.php’)) { require_once (ABSPATH.’/wp-admin/includes/taxonomy.php’); if ( ! get_cat_ID( ‘One page’ ) … Read more