Twenty Twelve 二〇一二主題

Twenty Twelve 二〇一二主題

Codex Home → BuddyPress Theme Development → BP Theme Compatibility and the WordPress Default Themes → Twenty Twelve Theme
Twenty Twelve Theme

A. One column Layout
One Column Layout. Click on image to enlarge.1. Create a child theme of the Twenty Twelve theme.
2. Create a new file in your new child theme folder and name it buddypress.php.
3. Copy over the content of Twenty Twelve』s full-width.php file into the new buddypress.php file.
?12345678910111213141516171819     

        

                                                

    

 
4. The buddypress class is generated in the body tag automatically for all BuddyPress pages when it』s activated. To change the width of the layout from full-width to one column, you only need to open up your theme』s style.css file and add the following
?12345678@ media screen and (min-width: 600px) {       body.buddypress .site-content {        float: none;        margin-left: auto;        margin-right: auto;        width: 70%;       }}
– delete the space between @ and media in media query above.
5. Upload the Twenty Twelve child theme folder to server.
B. Full-width Layout
Full-width Layout. Click on image to enlarge.1. Create a child theme of the Twenty Twelve theme.
2. Create a new file in your new child theme folder and name it buddypress.php.
3. Copy over the content of Twenty Twelve』s full-width.php file into the new buddypress.php file.
?12345678910111213141516171819     

        

                                                

    

 
4. The buddypress class is generated in the body tag automatically for all BuddyPress when it』s activated. So you only need to open up your theme』s style.css file and add the following
?12345@ media screen and (min-width: 600px) {       body.buddypress .site-content {              width: 100%;       }}
– delete the space between @ and media in media query above.
5. Upload your Twenty Twelve child theme folder to server.
C. Two Column, Right Sidebar Layout
Two-column Layout. Click on image to enlarge.This is the default page layout of the Twenty Twelve theme. There is no need to do anything more if this is the layout you prefer for all your BuddyPress pages.
However, if you want to customize the sidebar content of all your BP pages, you can do so by: a) using a plugin like Widget Logic to assign widgets to specific pages by using conditional tags or b) by creating new buddypress.php and sidebar-buddypress.php files and registering a new widget area in your child theme』s functions.php file. The following steps are for the second option.
1. Create a child theme of the Twenty Twelve theme.
2. Create a new file in your new child theme folder and name it buddypress.php.
3. Copy the content of Twenty Twelve theme』s page.php file into the new buddypress.php file. Then change get_sidebar() to get_sidebar('buddypress') and save file.
?1234567891011121314151617181920     

        

                                                

    

 
4. If you don』t have a functions.php file in your child theme, create one. You』ll need to register the new widget area for your BP sidebar in that functions.php file like so:
?1234567891011121314 __( 'BuddyPress Sidebar Widget Area', 'mmechildtheme' ),        'id'             => 'bp-sidebar',        'description'    => __( 'Appears in the sidebar section of all BuddyPress pages.', 'mmechildtheme' ),        'before_widget'  => '

',        'before_title'      => '

',        'after_title'    => '

',    ) );}add_action( 'widgets_init', 'mme_register_bp_widgets_area' );
5. Create a new file in your child theme folder and name it sidebar-buddypress.php. Add the following code to set up the widget area then save file.
?1234567891011121314151617     

 
7. Upload your child theme folder to your server. You』ll need to add at least one widget to the BP Sidebar widget area,

發表回覆

您的電子郵箱地址不會被公開。 必填項已用 * 標註