Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Hard Code Custom Sidebar Code Into A Specific Sidebar

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

  • surfartculture
    Participant

    @surfartculture

    I wanna the same

    i´ve try the same and not working, i can´t include sidebar!

    i wanna widgets can be added by members, independent…if u catch the right way, please let me now buddy ;)


    dainismichel
    Participant

    @dainismichel

    @surfartculture: members can add widgets to their member blogs automatically by going to their dashboards. That’s how BuddyPress works. You can make a test member blog and just switch the theme and members can add all the widgets they want. Do you know how to get to the member dashboard? Cruise through the top menu, you’ll find it.

    Let’s keep this thread on topic, OK? :-)

    This thread is for how to hard code a sidebar. I am looking for where to put the right code.


    dainismichel
    Participant

    @dainismichel

    I think I figured out a better way to ask this:

    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?


    @mercime
    Keymaster

    @mercime

    This is basic WordPress, see https://codex.wordpress.org/Template_Tags and click on the link to the specific template tag you’ll need to add.

    e.g. if you want a list of categories on your sidebar, you click on wp_list_categories link and you get this basic template tag, <?php wp_list_categories( ); ?>, and you add arguments per page I linked to.


    dainismichel
    Participant

    @dainismichel

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('blog-sidebar') ) : ?>

    <div class="widget-error">
    <?php _e( 'Please log in and
    add widgets to this column.', 'buddypress' ) ?>
    <a href="<?php echo
    get_option('siteurl') ?>/wp-admin/widgets.php?s=&show=&sidebar=blog-sidebar">
    <?php _e( 'Add Widgets', 'buddypress' ) ?></a>
    </div>

    <?php endif; ?>


    Brajesh Singh
    Participant

    @sbrajesh

    remove the ‘div’ widget error, and replace it with the code as mercime has pointed, that will make your hard coded functionality available to users when they do not add widgets, when they add widgets, this hard coded thing will not be shown.


    Brajesh Singh
    Participant

    @sbrajesh

    well I mean, the complete

    <div class="widget-error">
    <?php _e( 'Please log in and
    add widgets to this column.', 'buddypress' ) ?>
    <a href="<?php echo
    get_option('siteurl') ?>/wp-admin/widgets.php?s=&show=&sidebar=blog-sidebar">
    <?php _e( 'Add Widgets', 'buddypress' ) ?></a>
    </div>

    Should be replaced by your custom code.


    dainismichel
    Participant

    @dainismichel

    Tried to make the carriage returns understandable above.

    That’s sidebar.php

    To me, it seems to yielding

    dynamic_sidebar

    or

    log-sidebar

    or

    the error message

    I’m totally cool with the links you gave, and thanks tons for them. I can figure out how to do stuff with those links…it’s all there, tags, parameters, examples, etc.

    What I still don’t know how to do is where to put the dern code to make it appear in the first second or third “sections” (as described in functions.php), which I assume refers to the 1st 2nd or 3d sidebar.

    There is something really really obvious to you that I am just not seeing. I am sure it is SO OBVIOUS to you that you’re kinda banging your head against the wall due to my stupidity or blindness. But I don’t know where to put the code to get the had coded widgets (or tags) into the specific sidebars in the member theme.

    Please pardon my blindness on this one, since it looks like we’ve covered everything but the little key that would get me going.

    If there were something like dynamic_sidebar.php that had 3 sections in it, then I’d stick the code into the right place and move on, but I just can’t find where to put the code, or how to code “put this tag into sidebar 2”

    Thanks so much for going through the rounds with me on this one, and I’m again, really sorry that I am so blind here.


    dainismichel
    Participant

    @dainismichel

    Hi Brajesh Singh, thanks, we were posting simultaneously.

    How do I specify which sidebar the tag/widget will go into?

    Best,

    Dainis

    Soooo close :-)


    dainismichel
    Participant

    @dainismichel

    I just did this:

    <div id="sidebar">
    <?php do_action( 'bp_inside_before_blog_sidebar' ) ?>

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('blog-sidebar') ) : ?>

    <?php wp_list_categories( ); ?>

    <li id="archives"><?php _e('Archives:'); ?>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>

    <?php endif; ?>

    <?php do_action( 'bp_inside_after_blog_sidebar' ) ?>
    </div>

    and feel pretty cool, cuz it affected:

    http://community.urine-therapy.org/testing/

    But, I thought I was going to affect, and the theme I’m trying to change is this one:

    http://community.urine-therapy.org/testing2/

    …so I guess that orange theme does not use my created

    bp-sn-parent-members

    huh…

    Sheesh, where is that file dernit?


    dainismichel
    Participant

    @dainismichel

    OK, went in and selected the same theme for

    http://community.urine-therapy.org/testing2/ that

    http://community.urine-therapy.org/testing3/ uses,

    but the changes I made to sidebar.php have affected testing2 and not testing3. I’m actually pretty sure I am using the same theme on both of these test member blogs. Maybe I have to go in and reselect the theme for the changes to take effect? I don’t know on that one.

    Now, why don’t

    Blog

    Members

    Groups

    Forums

    Blogs

    work in either testing2 or testing3?

    Basically, I just want those links to go to the links of the main site.

    Is the logic that I make a blog and people come and make blogs and each blog gets members and sub members?

    Basically, what I am going for is:

    Members join and make a profile page and a blog.

    They can post but not make pages

    Their posts appear in sitewide activity

    When you visit their blog you see only the member’s posts

    There are no sub-sub members (members don’t have members)

    There are no sub-sub-blogs members only get one blog and that’s it

    I am starting to make some changes, but I really don’t know why just yet.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to Hard Code Custom Sidebar Code Into A Specific Sidebar’ is closed to new replies.
Skip to toolbar