Posts

Showing posts from October, 2015

WordPress is_super_admin Condition for menu or other

<?php //Removes the "Edit" menu for users who are not Super Admins of a multisite network if ( !is_super_admin() ) { add_action( 'admin_init', 'my_remove_edit_menu' ); } function my_remove_edit_menu() { remove_menu_page('edit.php'); } ?>

how to Single.php page add BACK button to parent category for WordPress

Way 1: ------------------------------------ <?php $cats=get_the_category();     foreach($cats as $cat){         if($cat->category_parent == 0 && $cat->term_id != 1){             echo '<h2 class="link"><a href="'.get_category_link($cat->term_id ).'">Return</a></h2>';         }         break;     } ?> Way 2: ------------------------------------ <a href="<?php $cat = get_the_category(); $cat = $cat[0]; echo get_category_link($cat->cat_ID); ?>">Return</a>