• ibblogosphere

    (@ibblogosphere)


    Hi everyone. I think this would be really easy for someone with php knowledge.

    I would like the following to only display on the homepage. I have attempted to wrap the… <?php if ( is_home() ) { ?> content <?php endif; ?> …but it gives an error message in my sidebar.
    Here’s the code and thanks in advance!

    <?php
    // this is where you enter the IDs of which categories you want to display
    $display_categories = array(11);
    foreach ($display_categories as $category) { ?>
    <div id=”sidebar_header”> </div><div id=”sidebar_gig”>
    <?php query_posts(“showposts=10&cat=$category”);
    $wp_query->is_category = false;
    $wp_query->is_archive = false;
    $wp_query->is_home = true;
    ?>

    <h3>”><?php
    // this is where the name of each category gets printed
    single_cat_title(); ?></h3><div class=”sub_text”>This week’s gigs ?</div>
    <?php while (have_posts()) : the_post(); ?>

    ” rel=”bookmark” class=”title”>

    * <?php
    // this is where title of the article gets printed
    the_title(); ?>?

    <?php the_excerpt(); ?>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>More?
    <?php endwhile; ?>

    </div>
    <div id=”sidebar_footer”>
    <div class=”icons”><!– AddThis Button BEGIN –>
    <?php echo “<div>
    <script type=\”text/javascript\”>
    var addthis_pub=\”strutter27\”;
    var addthis_logo = ‘https://www.boxadesign.co.uk/thejoycollective/wp-content/themes/mimbo2.2/images/joy_logo.gif&#8217;;
    var addthis_brand = ‘The Joy Collective’;
    </script>
    <img src=\”https://s7.addthis.com/static/btn/sm-plus.gif\” width=\”16\” height=\”16\” alt=\”Bookmark and Share\” style=\”border:0\”/><script type=\”text/javascript\” src=\”https://s7.addthis.com/js/200/addthis_widget.js\”></script></div>”; ?>
    <!– AddThis Button END –></div>
    <div class=”footnote”>”>view all gigs</div>
    </div>

    <?php } ?>

Viewing 1 replies (of 1 total)
  • bsteinlo

    (@bsteinlo)

    download slayer’s custom widget editor. works great and should do the trick without coding it yourself

Viewing 1 replies (of 1 total)
  • The topic ‘Only show sidebar section on homepage?!’ is closed to new replies.