Notice: Trying to get property of non-object in : custom fields category

Most probably the term was not found and $current_term returned as false: $current_term = get_term_by( ‘slug’, $term_slug, $taxonomyName ); $term_id = false === $current_term->term_id ? null : $current_term->term_id; According to the docs, get_term_by() return values are Term Row (object or array) from database. Will return false if $taxonomy does not exist or $term was not … Read more

Show Pages in Categories

Have you try: function my_custom_show_pages_in_category( $query ){ if( $query->is_category() && $query->is_main_query() ){ $query->set(‘post_type’, array(‘post’, ‘page’ ) ) ; } } add_action(‘pre_get_posts’, ‘my_custom_show_pages_in_category’ ); See more: Codex

How to make the ‘delete’ button inactive on some categories?

WordPress uses the WP_List_Table class, or some extension of it, to generate those lists. In this case, it is the WP_Terms_List_Table class. That class contains a filter called {$taxonomy}_row_actions. add_filter( ‘category_row_actions’, function($actions, $tag) { $no_del = array(11,22,33); if (in_array($tag->term_id,$no_del)) { unset($actions[‘delete’]); } return $actions; }, 10,2 );

Display unused categories in dropdown

wp_dropdown_categories() has a parameter specially to hide or to show empty categories. hide_empty (boolean) (optional) Show (0/False) or hide (1/True) category with no posts. Default: 1/True You can simply just hide_empty=0 to your arguments

Display a list of subcategories a post belongs to

Here is a function I’ve recently used (modified version of the code found in the codex) to display a list of the categories a post is attached to. This function first gets the parent category to which the post belong, and that info is then fed back into wp_list_categories to remove the parent category and … Read more

Output the text before category

I don’t see why you can not use plain text like tho Posted on <?php the_time(‘F j, Y’) ?> in <?php the_category(); ?> If what you are asking is really important, just wrap the function like this my_custom_category($before=””,$after=””){ echo $before; the_category() $echo $after; } If the_category is not picking the post ID, then pass it … Read more

Category specific order

EDIT I don’t really know of a solution within WordPress to sort the way you need. I think the best is to make use of php sorting to sort your returned array as needed Here is how: Get the array of category info as you normally do $categories = get_categories($args); $categories will hold an array … Read more

Show Posts from Single Category Not Working

Take a look the section called Preserving Existing Query Parameters on http://codex.wordpress.org/Function_Reference/query_posts Try merging in the existing query parameters; they might be getting overridden. Instead of: <?php query_posts(‘cat=4’); ?> try global $query_string; query_posts( $query_string . ‘&cat=4’ );