How to register and add a custom sidebar to theme.

Sidebars and widgets are most powerful things in WordPress. You can manage your content easily with them. You can create your own sidebars easily with just adding few lines of code in functions.php. You can give it any name and description and you can place it anywhere in your theme.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
function wpg_portfolio() { $labels = array( 'name' => _x( 'Projects', 'post type general name' ), 'singular_name' => _x( 'Project', 'post type singular name' ), 'add_new' => _x( 'Add New', 'Project' ), 'add_new_item' => __( 'Add New Project' ), 'edit_item' => __( 'Edit Project' ), 'new_item' => __( 'New Project' ), 'all_items' => __( 'All Projects' ), 'view_item' => __( 'View Project' ), 'search_items' => __( 'Search Projects' ), 'not_found' => __( 'No Projects found' ), 'not_found_in_trash' => __( 'No Projects found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Portfolio' ); $args = array( 'labels' => $labels, 'description' => 'Portfolio', 'public' => true, 'menu_position' => 32, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'project' ), 'capability_type' => 'post', 'taxonomies' => array('post_tag'), 'supports' => array( 'title', 'editor'), 'has_archive' => true, ); register_post_type( 'portfolio', $args ); } add_action( 'init', 'wpg_portfolio' ); |
Comments and Responses
Check out useful resources!
Slightly modded options framework [SMOF]
Are you theme developer? Now you can build your own custom theme options panel with this powerful options framework!
Advanced Custom Fields
Powerful fields for WordPress developers. Build advanced edit screens for your theme. A must have tool for theme developers. Use the Advanced Custom Fields plugin to take full control…
Sorry there is no comment yet. Why don't you leave one?!