• Hello, I have a few questions:

    1: How do I edit the various default sidebar items such as the category listings – I want to edit the actual HTML on each anchor so that there is a span within each (for styling purposes) but I cannot figure out where to change this. I know it’s got something to do with wp_list_categories(). So, for example, I want to have the list as it is but with <a><span>text</span></a> instead of <a>text</a>

    2: If I want to modify a bit of PHP in “post-template” or “category-template” under /includes then surely my changes will get wiped out when I upgrade to a newer version of WordPress, right?

    3: I have five pages. On each page I want to specify what sidebar items show. I don’t have to have this functionality within admin panel – I don’t mind doing it in sidebar.php … something like:

    My ideal sidebar.php –>

    ----
    if(page=="gallery"){
       showPhotosWidget();
    }
    if(page=="contact"){
       showContactInfo();
    }
    if(page=="blog") {
       showCategoryListing();
       showRecentPosts();
       showMyBookmarks();
    }
    ----

    I know those are not the functions or watever but hopefully you see what I mean…?

    ANY help is really appreciated! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • hi

    1)

    <span>text</span>

    – wp_list_categories won’t do that. you may be able to find a plugin that will

    2)

    modify a bit of PHP in “post-template” or “category-template”

    yes, it will be wiped out during updates. WordPress is designed to be modified with plugins, which don’t get wiped out with upgrades. There are thousands of them so you may find what you want to do already available, or something close.
    http://ww.wp.xz.cn/extend/plugins/

    3)

    if(page==”gallery”){
    showPhotosWidget();
    }
    if(page==”contact”){
    showContactInfo();
    }
    if(page==”blog”) {
    showCategoryListing();
    showRecentPosts();
    showMyBookmarks();
    }

    if(is_page('gallery')){
       showPhotosWidget();
    }
    if(is_page('blog')) {
       showCategoryListing();
       showRecentPosts();
       showMyBookmarks();
    }

    See this page on conditional tags
    http://codex.ww.wp.xz.cn/Conditional_Tags

    I’ve also been trying to discover ways of customising the sidebar – and came across the same problem.
    It turned out that the solution to what I was trying to do was fairly simple – see http://ww.wp.xz.cn/support/topic/206694?replies=3
    But I did come across a plug in which looked as though it might be helpful: http://ww.wp.xz.cn/extend/plugins/classy-wp-list-pages/
    Hope that helps.
    David

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

The topic ‘Need to customize sidebar.php’ is closed to new replies.