<?php
// Add RSS links to <head> section
automatic_feed_links();
add_theme_support('post-thumbnails');
// Load jQuery
if ( !is_admin() ) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
// Clean up the <head>
function removeHeadLinks() {
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
}
add_action('init', 'removeHeadLinks');
remove_action('wp_head', 'wp_generator');
// Declare sidebar widget zone
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Basic Sidebar',
'id' => 'basic-sidebar',
'description' => 'This is the basic sidebar for basic pages.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'Specific Sidebar',
'id' => 'specific-sidebar',
'description' => 'This is the secondary sidebar for specific pages.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
register_sidebar(array(
'name' => 'Footer Sidebar',
'id' => 'footer-sidebar',
'description' => 'This is the footer container for navigation.',
'before_widget' => '<nav class="footer-nav">',
'after_widget' => '</nav>',
'before_title' => '<h1>',
'after_title' => '</h1>'
));
}
// Declare Custom Menu
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'main-menu' => __( 'Main Menu' ),
'sidebar-menu' => __( 'Sidebar Menu' ),
'footer-menu' => __( 'Footer Menu' )
)
);
}
// END Custom Menu
// Remove Menu Classes & Id
add_filter('nav_menu_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('nav_menu_item_id', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_class', 'my_css_attributes_filter', 100, 1);
add_filter('page_css_id', 'my_css_attributes_filter', 100, 1);
function my_css_attributes_filter($var) {
return is_array($var) ? array_intersect($var, array('current-menu-item')) : '';
}
// hook into the init action and call create_property_taxonomies() when it fires
add_action( 'init', 'create_property_taxonomies', 0 );
// create taxonomies, type for the post type "properties"
function create_property_taxonomies() {
// Add new taxonomy, NOT hierarchical (like tags)
$labels = array(
'name' => _x( 'Types', 'taxonomy general name' ),
'singular_name' => _x( 'Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Types' ),
'popular_items' => __( 'Popular Types' ),
'all_items' => __( 'All Types' ),
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit Types' ),
'update_item' => __( 'Update Types' ),
'add_new_item' => __( 'Add New Type' ),
'new_item_name' => __( 'New Type Name' ),
'separate_items_with_commas' => __( 'Separate types with commas' ),
'add_or_remove_items' => __( 'Add or remove types' ),
'choose_from_most_used' => __( 'Choose from the most used types' )
);
register_taxonomy( 'types', 'properties', array(
'hierarchical' => false,
'labels' => $labels, /* NOTICE: the $labels variable here */
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'type' ),
));
} // End of create_property_taxonomies() function.
// Remove Unnecassary Menu Items.
function remove_menus () {
global $menu;
$restricted = array(__('Posts'), __('Comments'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
}
add_action('admin_menu', 'remove_menus');
// END Remove Unnecassary Menu Items.
// Customize the admin footer.
function modify_footer_admin () {
echo 'Created by <a href="http://scottcarlton.net">Scott Carlton</a>. ';
echo 'Powered by <a href="http://WordPress.org">WordPress</a>.';
}
add_filter('admin_footer_text', 'modify_footer_admin');
// Customize the admin menus
function custom_menu_order($menu_ord) {
if (!$menu_ord) return true;
return array(
'index.php', // this represents the dashboard link
'seperater_1', // this represents the dashboard link
'edit.php?post_type=page', //the posts tab
'edit.php?post_type=properties', //the posts tab
'edit.php?post_type=bios', //the posts tab
'upload.php', // the media manager
);
}
add_filter('custom_menu_order', 'custom_menu_order');
add_filter('menu_order', 'custom_menu_order');
// Customize Admin Login Logo
function my_custom_login_logo()
{
echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/main_Logo.png) !important; } </style>';
}
add_action('login_head', 'my_custom_login_logo');
// Add Toggle jQuery
add_action( 'wp_enqueue_scripts', 'add_my_js' );
function add_my_js() {
wp_register_script( 'my-author-js', get_template_directory_uri() . '/author-toggle.js', array( 'jquery' ), false, true );
wp_enqueue_script( 'my-author-js' );
}
?>