Using a portfolio_category slug in wordpress URL

add ‘rewrite’ => array(‘slug’ => ‘portfolio-categories’), but be sure to remove (not sure why that’s there, it tries hides the slug yet tries to rename it to “products” at the same time?): ‘rewrite’ => array( ‘with_front’ => false, ‘slug’ => ‘products’ ), So it looks like this: function mysite_post_types() { register_post_type(‘portfolio’, array( ‘labels’ => array( … Read more

If in category to be inside of a function

If you want to use the function to output the code somewhere: function displayImage($currentPost) { // Show the featured icon only if current post is in “featured” category if ( in_category ( ‘featured’, $currentPost ) ) { $output=”<a href=”https://wordpress.stackexchange.com/questions/58811/<?php the_permalink(); ?>”> <span class=”featured_icon”> <img src=”<?php bloginfo(“template_directory’); ?>/images/featured_icon.png” /> </span> </a>’; } else { $output=”” }; … Read more

Add Post Screen Keep Category structure

Yup. Use the add_meta_boxes_post to add a new category metabox that preserves the structure and while you’re at it, remove the default one, like this: add_action( ‘add_meta_boxes_post’, ‘fix_hierarchical_post_categories_metaboxes’, 10, 1 ); And here’s the callback: /* * This include provides an alternative post category metabox that sets the checked_ontop argument of wp_terms_checklist to false. * … Read more