Add category description in code

Community Forums Forums Design Tips and Tricks Add category description in code

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  Mr_Vercetti 4 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #113611

    Mr_Vercetti
    Member
    Post count: 6

    Hey all.

    So I’ve done some customization to my News Pro theme, which lists category pages like a grid.

    The problem is that I lost the category description which is extremely bad for my SEO.

    I added this .php file to the root of my child theme dir:

    <?php
    /**
    * This file adds the category archive template.
    *
    */

    //* Force full width content layout
    add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_full_width_content’ );

    //* Remove the post info function
    remove_action( ‘genesis_entry_header’, ‘genesis_post_info’, 5 );

    //* Remove the post content
    remove_action( ‘genesis_entry_content’, ‘genesis_do_post_content’ );

    //* Remove the post image
    remove_action( ‘genesis_entry_content’, ‘genesis_do_post_image’, 8 );

    //* Add portfolio body class to the head
    // add_filter( ‘body_class’, ‘executive_add_portfolio_body_class’ );
    function executive_add_portfolio_body_class( $classes ) {
    $classes[] = ‘executive-pro-portfolio’;
    return $classes;

    }

    /**
    * Display as Columns
    *
    */
    function be_portfolio_post_class( $classes ) {
    $columns = 3; // Set the number of columns here

    $column_classes = array( ”, ”, ‘one-half’, ‘one-third’, ‘one-fourth’, ‘one-fifth’, ‘one-sixth’ );
    $classes[] = $column_classes[$columns];
    global $wp_query;
    if( 0 == $wp_query->current_post || 0 == $wp_query->current_post % $columns )
    $classes[] = ‘first’;

    return $classes;
    }
    add_filter( ‘post_class’, ‘be_portfolio_post_class’ );

    // Category description
    echo category_description( $category->term_id );

    //* Add the featured image after post title
    add_action( ‘genesis_entry_header’, ‘sk_category_grid’ );
    function sk_category_grid() {

    if ( $image = genesis_get_image( ‘format=url&size=category-image’ ) ) {
    printf( ‘<div class=”category-grid-post-featured-image”>%s</div>’, get_permalink(), $image, the_title_attribute( ‘echo=0′ ) );

    }

    }

    //* Customize entry meta in the entry header
    add_filter( ‘genesis_post_info’, ‘sp_post_info_filter’ );
    function sp_post_info_filter($post_info) {
    // $post_info = ‘[post_date] by [post_author_posts_link] [post_comments] [post_edit]‘;
    $post_info = ‘[post_date] [post_edit]‘;
    return $post_info;
    }

    //* Remove the post meta function
    remove_action( ‘genesis_entry_footer’, ‘genesis_post_meta’ );

    genesis();

    And a link to a random category page on my site: http://mallorcaoplevelser.dk/category/restauranter-cala-mayor/

    http://www.mallorcaoplevelser.dk
    #113612

    Mr_Vercetti
    Member
    Post count: 6

    I’m just really eager to get a nice grid layout into my categories. If any of you have a better solution, please say so.

    Best regards

    Jesper

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.