Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using WordPress 3.4.2 and i have created a category name wall and I have added 5 posts with category wall. And now i want to create a page with site.com/wall_page and it should only display post with category wall. I am using a theme Genesis with child theme as Magazine Child Theme.

And i have created a new file in Magazine Child Theme directory with category-wall.php and added the below code.

<?php
/**
 * Template Name: Category wall
 */
remove_action( 'genesis_loop', 'genesis_do_loop' ); // Remove default loop
//add_action('genesis_post_content','the_content');  // Adds your custom page code/content before loop
add_action( 'genesis_loop', 'category_page' ); // Do custom loop
function category_page() {
    //add_action('genesis_loop', 'genesis_standard_loop');
    echo '<h1>';
    the_title(); // add title
    echo '</h1>';
    the_content();
    echo '<div class="entry-content">';
    child_grid_loop_helper();
    echo '</div<!-- end .entry-content -->' ;
}
function child_grid_loop_helper() {
    global $paged;
    $cat = 'wall'; // set default category
    if (function_exists('genesis_grid_loop')) {
        if (function_exists('genesis_get_custom_field')){
            $cat = genesis_get_custom_field('category'); // set from custom field when building page
        }
        //set featured grid_args
        ///*
        $grid_args_featured = array(
            'features' => 1,
           // 'feature_image_size' => 'child_full',
            //'feature_image_class' => 'aligncenter post-image',
            'feature_content_limit' => 150,
            //'grid_image_size' => 'child_thumb',
            //'grid_image_class' => 'aligncenter post-image',
            'grid_content_limit' => 0,
            //'more' => '',
            'posts_per_page' => 1,
           'post_type' => 'post',
            'category_name' => $cat,
            'paged' => $paged
        );
        //*/
        //set non-featured grid_args
        $grid_args_rest = array(
            'features' => 0,
            //'feature_image_size' => 'child_full',
            //'feature_image_class' => 'aligncenter post-image',
            //'feature_content_limit' => 100,
            //'grid_image_size' => 'child_thumb',
            //'grid_image_class' => 'aligncenter post-image',
            'grid_content_limit' => 150,
            //'more' => '',
            'posts_per_page' => 5,
            'post_type' => 'post',
            'category_name' => $cat,
            'paged' => $paged
        );
      //assuming that features won't go beyond 1 page
      // genesis_grid_loop( $grid_args_rest );
     //  /*
        if ( ($grid_args_featured['paged'] > 1) || ($grid_args_past['paged'] > 1) )
            genesis_grid_loop( $grid_args_rest ); //do not show featured after page 1
        else {
            genesis_grid_loop( $grid_args_featured );
            genesis_grid_loop( $grid_args_rest );
        }
        //*/
    } else {
        genesis_standard_loop();
    }
}
genesis();

And how can i do view a page with these category And where do i create this page template file, whether i need place in child or genesis directory

share|improve this question
1  
Close-voted as too localized. As Genesis is a commercial Theme, we don't have access to the code to be able to help provide an answer. Have you tried StudioPress support? – Chip Bennett Nov 21 '12 at 13:06
1  
No i havn't got with them yet. – Rafee Nov 21 '12 at 13:46

closed as too localized by toscho Jan 26 at 5:00

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.