Support » Fixing WordPress » Add code to category Page for subcategory boxes – loop/posts disappear?

  • Hey Guys,

    I’m trying to port this code which Adds Subcategory Boxes on Category Page – I already have the code to do this and it works on my old TwentyTen Theme, so can just copy the code from my old categories.php file.

    Im trying to port this across to work with my new theme Genesis Framework and Fairway Genesis Child Theme. But when I upload my categories.php file to either genesis folder or the folder for the fairway genesis child theme, the category boxes appear but the posts don’t? So what else do I need to do?

    That part “Run the loop for the category page to output the posts” in this code explains what do I but I don’t understand how to do I implement this for my Genesis Child theme install?
    e.g. on this category page
    It is supposed to display boxes up the top with the subcategories: Buying Facebook Fans, Facebook Advertising, Facebook Guide, Facebook Page Templates, Facebook Traffic, Get Facebook Likes

    P.S. This is the code


    * The template for displaying Category Archive pages.


    * @package WordPress

    * @subpackage Twenty_Ten

    * @since Twenty Ten 1.0


    get_header(); ?>

    <div id=”container”>

    <div id=”content” role=”main”>

    <style type=’text/css’>

    .joe_sc {



    .joe_sc a { display:block; float:left; text-align:center; color:#666; width:200px; height:100%; background: #E9FFEF; padding:10px; border: solid #D2F5DB 1px; margin:5px;}

    .joe_sc a:hover { color:#000; background: #C9EECF; }



    global $wp_query;

    $subcategories = get_categories(“child_of={$wp_query->query_vars[‘cat’]}”);

    if(count($subcategories) >= 1) {

    echo “<h1 class=’page-title’>Subcategories</h1>”;

    echo “<div style=’color:#666;position:relative;top:-12px;’><small>Click on a category to see the products within.</small></div>”;

    foreach($subcategories as $sc) {

    echo “<div class=’joe_sc joe_subcategory_{$sc->cat_ID}’>cat_ID) . “‘>” . $sc->name . “</div>”;


    echo “<br clear=’all’ />”;




    $category_description = category_description();

    if ( ! empty( $category_description ) )

    echo ‘<div class=”archive-meta”>’ . $category_description . ‘</div>’;

    /* Run the loop for the category page to output the posts.

    * If you want to overload this in a child theme then include a file

    * called loop-category.php and that will be used instead.


    get_template_part( ‘loop’, ‘category’ );


    </div><!– #content –>

    </div><!– #container –>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

  • The topic ‘Add code to category Page for subcategory boxes – loop/posts disappear?’ is closed to new replies.