Here are some classic nuggets I use all the time when developing and enhancing WordPress themes.
From Digging Into WordPress: https://digwp.com
Dynamic Copyright in your WordPress Footer
1 |
<p>© <?php echo date("Y"); echo " "; echo bloginfo('name'); ?></p> |
Adding Custom Menu Locations in WordPress Themes
1 2 3 4 5 6 7 8 9 10 |
// Add Your Menu Locations function register_my_menus() { register_nav_menus( array( 'header_navigation' => __( 'Header Navigation' ), 'expanded_footer' => __( 'Expanded Footer' ) ) ); } add_action( 'init', 'register_my_menus' ); |
1 2 3 4 5 6 7 8 |
<?php wp_nav_menu(array( 'theme_location' => 'header_navigation', // menu slug from step 1 'container' => false, // 'div' container will not be added 'menu_class' => 'nav', // <ul class="nav"> 'fallback_cb' => 'default_header_nav', // name of default function from step 2 )); ?> |
function hide_update_notice_to_all_but_admin_users()
{
if (!current_user_can(‘update_core’)) {
remove_action( ‘admin_notices’, ‘update_nag’, 3 );
}
}
add_action( ‘admin_head’, ‘hide_update_notice_to_all_but_admin_users’, 1 );
No Comment