WordPress 1 domain multiple blogs
Just use different categories and link your “blog” to the category page.
Just use different categories and link your “blog” to the category page.
I really doubt this is filterable, so jQuery comes to rescue 🙂 The Code add_action( ‘admin_footer-post.php’, ‘wpse_22836_remove_top_categories_checkbox’ ); add_action( ‘admin_footer-post-new.php’, ‘wpse_22836_remove_top_categories_checkbox’ ); function wpse_22836_remove_top_categories_checkbox() { global $post_type; if ( ‘post’ != $post_type ) return; ?> <script type=”text/javascript”> jQuery(“#categorychecklist>li>label input”).each(function(){ jQuery(this).remove(); }); </script> <?php } The Result Advanced There’s a caveat: whenever selecting a sub-category, it … Read more
There are two ways of doing it: You can use a filter to alter the query when viewing an archive page. You will need to find the ID of your category ‘blogs’ (you can obtain it from the slug using get_term_by). Alternatively you can exclude a particular category by ID. add_action( ‘pre_get_posts’, ‘my_change_query’); function my_change_query($query){ … Read more
I suggest creating 3 files 1) regiontemplate-country.php 2) regiontemplate-city.php These 2 will contain the templates for country & city, then 3) taxonomy-region.php In this file, add the code to load the appropriate template <?php $term = get_term_by(‘slug’, get_query_var(‘term’), ‘region’); if((int)$term->parent) get_template_part(‘regiontemplate’, ‘city’); else get_template_part(‘regiontemplate’, ‘country’);
I rewrote the code from a post at WP Engineer: function wpse_filter_child_cats( $query ) { if ( $query->is_category ) { $queried_object = get_queried_object(); $child_cats = (array) get_term_children( $queried_object->term_id, ‘category’ ); if ( ! $query->is_admin ) //exclude the posts in child categories $query->set( ‘category__not_in’, array_merge( $child_cats ) ); } return $query; } add_filter( ‘pre_get_posts’, ‘wpse_filter_child_cats’ ); … Read more
This same exact question was asked earlier this week or over the weekend, and it had me thinking. Here is the idea that I came up with. If you look at the source code of the WP_Query class, you will see that sticky posts is only added to the first page of the home page. … Read more
Just set ‘hierarchical’ => true in the args to register_taxonomy() (even if you never intend to add terms with parent-child relationships) and you will get the same UI for assigning terms from that custom taxonomy when creating/editing that custom post type as you would with the builtin category taxonomy. And if you want a dropdown … Read more
Try get_categories( array(‘hide_empty’ => 0 ) );
Use has_category instead. if (has_category(”,$post->ID)) … If you want to use it in The Loop, you don’t need to specify the ID. if (has_category()) …
If you want a plugin solution, advanced custom fields can do this.