Support » Fixing WordPress » Conditional tags, variable sidebar. not working with new theme

  • Resolved fruityxcore


    I downloaded the Marki theme from Ikram Zidane’s website and I want to add conditional tags to the sidebar so that there is variable sidebar content on each page.

    I’ve added the tags to the sidebar.php but it doesn’t seem to work. I keep getting parsing errors. I just need to be pointed in the right direction as to where I’m going wrong.

    Any help will be appreciated.

    here is the sidebar.php that I’ve edited.

    <div id="sidebar">
    <div class="sidebar-left">
    if (is_home()) {
    <h2 id="cat-heading">Categories</h2>
    <ul id="categorylist">
    <?php wp_list_cats('sort_column=name&hide_empty=0&optioncount=1'); ?>
    <div class="sidebar-right">
    <h2 id="late-news">Categories</h2>
    <ul id="categorylist2">
    <?php wp_get_archives('sort_column=name&hide_empty=0&optioncount=1'); ?>
    <div class="editor-pick">
    <div class="edit">Hello and welcome to my site</div>
    Hello and Welcome to "My Weblog". I'm the author of this blog. You may edit this part to you liking (well, it's quite obvious since this is your blog). This theme was downloaded from <a href=""></a> for free. You may edit the theme as you like as long as you do not remove the copyright statement at he the bottom of the design "Handcrafted by <a href=""></a>, originally for with valid Xhtml and Css with <a href="">WebStandards</a> always in mind".
    } elseif (is_page()) {
        if (is_page('About')) {
                 echo "<p>This is my about page!</p>";
            } else {
                  // catch-all for other pages
                  echo "<p>Vote for Pedro!</p>";
    } else {
            // catch-all for everything else (archives, searches, 404s, etc)
            echo "<p>Pedro offers you his protection.</p>";
    } // That's all, folks!
    <div class="technorati">
    <span class="line"></span>
    <h3>Found it all ? Make a search</h3>
    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
    <div><input type="text" id="searchform2" value="<?php echo wp_specialchars($s, 1); ?>" name="s" />
    <input type="submit" id="searchsubmit2" value="Search" />
    <div class="clearboth">&nbsp;</div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The
    if (is_home()) doesn’t work with WP 2.3 and up. The new code is:

    if (is_front_page())

    PS: this might not solve your problem entirely, but I’m not familiar enough with PHP to see any other errors.

    Thank you for the reply but when I used the tag, it came up with an error. I don’t know if its because the Marki theme was designed for wordpress version 2.1, and I’m using it on 2.3??

    Anyway I’ll keep on looking up tutorials and trying…

    You might want to check all the changes in 2.3. There’s also a list of compatible themes in there.

    Hey there!

    Thanks for your help. I’ve managed to sort it out. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional tags, variable sidebar. not working with new theme’ is closed to new replies.