AZ Directory category

I wrote a tutorial on Creating an Alphabetical Glossary of Posts but here are the most relevant parts. First create a hidden taxonomy for the letters of the alphabet // Add new taxonomy, NOT hierarchical (like tags) function kia_create_glossary_taxonomy(){ if(!taxonomy_exists(‘glossary’)){ register_taxonomy(‘glossary’,array(‘post’),array( ‘show_ui’ => false )); } } add_action(‘init’,’kia_create_glossary_taxonomy’); Then when any post is saved, save … Read more

How to create a category or tag available exclusively to the admins and not to the users?

Sure, you can restrict access to a tag with the following code: add_action(‘save_post’, ‘remove_tags_function’, 10, 2); function remove_tags_function( $post_id ){ if(!current_user_can(‘manage_options’)){ $post_tags = wp_get_post_terms( $post_id, ‘post_tag’, array( ‘fields’=>’names’ ) ); $pos = array_search( ‘ExclusiveContent’, $post_tags ); if( false !== $pos ) { unset( $post_tags[$pos] ); wp_set_post_terms ($post_id, $post_tags, ‘post_tag’); } } } So, with this … Read more

Category base 404 – fix

Yes, there is such way. To be precise, there are many ways to accomplish that. You can add ‘Category’ page. Make sure that its slug is set to ‘category’. If you go to example.com/category/ then this page will be shown. If there were no custom changes to rewrite rules, then WordPress will first try to … Read more

Check if a post is in specific category to show an icon

Add post_class() to the post container div: <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> <!– post markup here –> </div> …which will give you, among other classes: .category-{ID} .category-{slug} You can then target those classes via CSS to add category-specific icons.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)