How to use category as landing page

4.58K viewsCore
0

Please i would like to use categories as landing page, is there a way arround this?

0

Simply follow this steps:

create a home.php in your theme and paste this PHP codes:

global $question_categories, $ap_max_num_pages, $ap_per_page;

$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$per_page           = ap_opt('categories_per_page');
$total_terms        = wp_count_terms('question_category');  
$offset             = $per_page * ( $paged - 1) ;
$ap_max_num_pages   = $total_terms / $per_page ;

$cat_args = array(
    'parent'        => 0,
    'number'        => $per_page,
    'offset'        => $offset,
    'hide_empty'    => false,
    'orderby'       => 'count',
    'order'         => 'DESC',
);

/**
 * FILTER: ap_categories_shortcode_args
 * Filter applied before getting categories.
 * @var array
 * @since 1.0
 */
$cat_args = apply_filters('ap_categories_shortcode_args', $cat_args );

$question_categories = get_terms( 'question_category' , $cat_args);

include ap_get_theme_location('categories.php', CATEGORIES_FOR_ANSPRESS_DIR);

And make sure your home page is set to static.

So, I do this from cpanel or from my wordpress dashboard?

You are viewing 1 out of 1 answers, click here to view all answers.