Skip to content

Instantly share code, notes, and snippets.

@juarezpaf
Created April 27, 2010 01:02
Show Gist options
  • Select an option

  • Save juarezpaf/380171 to your computer and use it in GitHub Desktop.

Select an option

Save juarezpaf/380171 to your computer and use it in GitHub Desktop.
<?php
//Custom nav menu support
add_theme_support('nav-menus');
//Usage: wp_nav_menu(array('sort_column' => 'menu_order', 'container_class' => 'menu-header'));
//Automatically add Feed links
add_theme_support('automatic-feed-links');
//Post thumbnails (was available in v2.9)
add_theme_support('post-thumbnails');
//Usage: the_post_thumbnail();
//Custom background
add_custom_background();
//Custom header
//The %s is a placeholder for the theme template directory URI.
define('HEADER_IMAGE', '%s/images/header.png'); //The default header
define('HEADER_IMAGE_WIDTH', apply_filters('', 800)); //Width of header
define('HEADER_IMAGE_HEIGHT', apply_filters('', 200)); //Height of header
define('NO_HEADER_TEXT', true);
add_custom_image_header('', 'admin_header_style'); //This Enables the Appearance > Header
//Following Code is for Styling the Admin Page
if(!function_exists('admin_header_style')){
function admin_header_style() {
?>
<style type="text/css">
#headimg {
height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
}
#headimg h1, #headimg #desc {
display: none;
}
</style>
<?php
}
}
//Custom post types and taxonomies example
function post_type_albums() {
register_post_type(
'albums',
array(
'label' => __('Albums'),
'public' => true,
'show_ui' => true,
'supports' => array(
'post-thumbnails',
'excerpts',
'trackbacks',
'comments'
)
)
);
// Adding the Custom Taxonomy for Genres. Here we can create categories specific for this post type.
register_taxonomy( 'genres', 'albums', array( 'hierarchical' => true, 'label' => __('Genres') ) );
// Adding the Custom Taxonomy for Performer. Here we can add tags specific for this post type.
register_taxonomy('performer', 'albums',
array(
'hierarchical' => false,
'label' => __('Performer'),
'query_var' => 'performer',
'rewrite' => array('slug' => 'performer')
)
);
}
add_action('init', 'post_type_albums');
?>
@juarezpaf

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment