Create terms when registering taxonomy?
use wp_insert_term() (after you register the taxonomy) You can also check if a term exists() before doing that, to save some useless db queries…
use wp_insert_term() (after you register the taxonomy) You can also check if a term exists() before doing that, to save some useless db queries…
function parent_child_cat_select() { ?> <script type=”text/javascript”> /* <![CDATA[ */ jQuery(document).ready(function() { jQuery(‘#parent_cat’).change(function(){ var parentCat=jQuery(‘#parent_cat’).val(); // call ajax jQuery.ajax({ url:”/wp-admin/admin-ajax.php”, type:’POST’, data:’action=category_select_action&parent_cat_ID=’ + parentCat, success:function(results) { jQuery(“#sub_cat_div”).html(results); } }); }); }); /* ]]> */ </script> <form action=”<?php bloginfo(‘url’); ?>/” method=”get”> <div id=”parent_cat_div”><?php wp_dropdown_categories(“show_option_none=Select parent category&orderby=name&depth=1&hierarchical=1&id=parent_cat”); ?></div> <div id=”sub_cat_div”><select name=”sub_cat_disabled” id=”sub_cat_disabled” disabled=”disabled”><option>Select parent category first!</option></select></div> <div id=”submit_div”><input … Read more
The functions accept an $in_same_cat argument, the default value of which is false. Just set that to true. previous_post_link($format, $link, true); next_post_link($format, $link, true);
Short answer: No – it can’t be done. Long answer: Category slugs must be unique, regardless of parent. Although quite a few people like to call this a bug, it’s actually by design. Basically, since categories can be moved around at will, the slugs must be unique. Sure, it’s nested properly now, but if you … Read more
You can use template_redirect action hook to achieve that: add_action(‘template_redirect’, ‘redirect_category_posts’); function redirect_category_posts() { global $post; if (is_single($post->ID) && in_category(‘category-name’, $post)) { $new_url = “http://category-name.mydomain.com/{$post->post_name}.html”; wp_redirect($new_url, 301); exit; } } Please note that both posts in main domain and in sub-domain must have the same slug or post_name for this code to work.
Regular expression jiggery pokery identified: <?php $categories = wp_list_categories(‘title_li=&show_count=1&echo=0’); $categories = preg_replace(‘/<\/a> \(([0-9]+)\)/’, ‘ <span class=”count”>[\\1]</span></a>’, $categories); echo $categories; ?>
Eliminating all of the other solutions, there is at least one remaining: template_redirect: function wpse121308_redirect_homepage() { // Check for blog posts index // NOT site front page, // which would be is_front_page() if ( is_home() ) { wp_redirect( get_category_link( $id ) ); exit(); } } add_action( ‘template_redirect’, ‘wpse121308_redirect_homepage’ ); You will need to pass the … Read more
The error says it all, you are sending the request to a invalid host. Change this: var ajaxurl=”http://my-site.co.uk <?php bloginfo(“wpurl”);?>/wp-admin/admin-ajax.php”; To: var ajaxurl = “<?php echo esc_js( admin_url( ‘admin-ajax.php’ ) ) ?>”; Note: from your code and description I’m assuming you are generating the jQuery code within PHP and it is not in a js … Read more
This piece of code will return you the child categories of a parent- $cat = get_category( get_query_var( ‘cat’ ) ); $cat_id = $cat->cat_ID; $child_categories=get_categories( array( ‘parent’ => $cat_id ) ); Just pass the category id to $cat_id variable which children you want. After that you can design or print those as you want. Example- foreach … Read more
Seems to be a long-standing issue. This plugin seems to do the trick. I’ve also found an alternative solution (which I’ve posted in the thread). Reproduced below: <?php add_filter( ‘nav_menu_meta_box_object’, ‘disable_pagination_in_menu_meta_box’, 9 ); function disable_pagination_in_menu_meta_box($obj) { $obj->_default_query = array( ‘posts_per_page’ => -1 ); return $obj; } ?> Update: Needs to be added with priority 9 … Read more