How to get the deleted category id?

Use the delete_category action, which passes category id as an argument: function my_category_delete_function( $id ){ // do something with category $id } add_action( ‘delete_category’, ‘my_category_delete_function’, 10, 1 );

Category Template – Show Last Entry as Featured

Use WP_Query’s built in current_post counter in your loop: while( have_posts() ): the_post(); if( $wp_query->current_post == 0 ): // this is the first post in the loop else: // this is > first post endif; endwhile; EDIT w/html: <?php while( have_posts() ): the_post(); if( $wp_query->current_post == 0 ): ?> featured post category description <ul> <?php … Read more

Custom Portfolio Page

You say you have a page for your portfolio, then go on to say you want posts displayed; confusing. Assume you have a category for posting items into named portfolio. New portfolio items will be posted in the portfolio category. You can take your categories.php page, copy and re-name it categories-portfolio.php, then customize it as … Read more

How to detect /category and /tag base pages?

There is no good way to do this, but it can be done in a way. When you visit /category/ it serves it as though you are visiting a page called category. You can look for this like: global $wp_query; if ($wp_query->query_vars[‘pagename’] == “category”) { // This is base category } else if ($wp_query->query_vars[‘pagename’] == … Read more

handling the featured category

as moraleida mentions, your setup is a custom implementation specific to your theme, not native to WordPress. rather than use a category, I would use post metadata to designate posts as featured. I would additionally create a custom meta box to designate the post as featured, that way, on the back end, I can store … Read more

Category URL Management

You could filter ‘term_link’. just an untested idea, written directly into the answer field add_filter( ‘term_link’, ‘wpse_55476_categore_ur_filter’, 10, 3 ); function wpse_55476_categore_ur_filter( $termlink, $term, $taxonomy ) { if ( ‘category’ !== $taxonomy ) { return $termlink; } // separate the URL $parts = explode( “https://wordpress.stackexchange.com/”, $termlink ); // get the term $term_slug = array_pop( $parts … Read more