Skip to:

How To Hard Code Widgets Into Member Themes

Viewing 6 replies - 1 through 6 (of 6 total)

  • @mercime


    Basically, you just delete or not add the function and the closing tag that makes the sidebar dynamic or widgetized.

    For example, open up WPMU’s default theme’s sidebar.php. You will see near the top of the file …

    <div id="sidebar" role="complementary">
    <?php /* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    <?php get_search_form(); ?>

    and the file ends ends with

    <?php endif; ?>

    So you delete the

    <?php 	/* Widgetized sidebar, if you have the plugin installed. */
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

    near the top of the sidebar.php file and delete

    <?php endif; ?> near the bottom of the sidebar.php file

    The codes before, in between and after these are hardcoded now. Your members cannot change anything in the sidebar.



    I wanna members can change sidebars, i wanna let members add sidebars widgets on their own profiles, how can I do this?



    @surfartculture – you have many threads regarding this including wherein you’ll find a helpful code regarding this matter from Boone Gorges:

    global $bp;
    if ( $bp->loggedin_user->id == 1 ) {
    /* Display the stuff you want user 1 to see */
    } else if ( $bp->loggedin_user->id == 2 ) {
    /* Stuff you want user 2 to see */
    } /* etc */

    But you have to give more information about your installation so that forum volunteers can help you out specific on your install.

    1. What WPMU version?

    2. What BuddyPress version?

    3. What theme are you using?

    4. Site URL?



    OK, this helps as well

    Now, how can I find where to put those customizations if I’ve

    copied bp-default and named it bp-default-members

    copied bp-sn-parent and named it bp-sn-parent-members

    appropriately called bp-sn-parent-members from bp-default-member’s style.css file

    …what I mean is that when I look at sidebar.php. it looks like it’s putting the same code into all 3 sidebars to me…so how do I put the customization I want into the sidebar I select?

    Also, since this is BuddyPress, how do I make sure that I’m pulling in “Recent Posts” from the member blog and not from all blogs…maybe that’s what happens anyway…

    and how do I define what people will see when viewing a member’s posts? Is that one of the existing sidebars? I actually hope not, since I want to code that differently.



    For example: Where would I put “<?php wp_list_categories(‘title_li=’ . __(‘Categories:’)); ?>” to have the categories show up in the rightmost sidebar?

    What file do I put the code into and where?

    Where do I put the code for each individual sidebar?



    Ahh, I think I may be asking the wrong question.

    Can you give me a code snippet that would hard code, for example, categories into a specific sidebar and show me how to go from there (inserting code for specific widgets into specific sidebars) on my own?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How To Hard Code Widgets Into Member Themes’ is closed to new replies.
Skip to toolbar