text at top of category

Community Forums Forums Design Tips and Tricks text at top of category

This topic is: not resolved

This topic contains 2 replies, has 3 voices, and was last updated by  braddalton 1 year, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #42214

    cway
    Participant
    Post count: 29

    Is it possible to display a page at the top of a category?

    This is a category: http://www.oldtownsq.com/category/residential/

    The text and Summary you see there is hard coded into the category.php file. Is it possible to move that test to a page and have that page show at the top of the category?

    Thanks!

    Cameron

    #42237

    anitac
    Participant
    Post count: 6991

    You can try this. It works but not sure how it will react to so much content.

    Add this to your functions.php file. What it does is add the space at the top of the Categories for the description. Once you add this, you would go to the Category and add the content to the Description box. I used it for a client who wanted to add monthly spreadsheets to the top of his categories. This made it easy for him to do it.

    [php]/**
    * Add archive page title and description
    *
    * @author Yoast
    * @link http://yoast.com/wordpress-archive-pages/
    */

    function yoast_term_archive_intro() {
    if ( !is_category() && !is_tag() && !is_tax() )
    return;

    if( get_query_var( ‘paged’ ) )
    return;

    echo ‘<h1 class="entry-title">’.single_term_title(”, false).’</h1>’;
    echo ‘<div class="entry-content">’.wpautop( term_description() ).’</div>’;
    }
    add_action( ‘genesis_before_loop’, ‘yoast_term_archive_intro’, 20 );[/php]

    I got this from the developer of the Yoast SEO Plugin.


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #42259

    braddalton
    Participant
    Post count: 8797

    By default, Genesis includes an intro text field for all categories so you simply navigate to the category archive and edit the page where you can add intro text and a heading. No need to add Yoast’s code when using Genesis.

    You could also add a widget area before your archives are listed using PHP code:

    Here’s some code you can modify and add to your child themes functions.php file:

    You can change the conditional tag to is_category(i.d) and also change the position your widget content outputs by changing the genesis_hook.

    Example:
    [php]

    add_action( ‘genesis_before_content_sidebar_wrap’, ‘wpsites_before_category_widget’, 9 );
    function wpsites_before_category_widget() {
    if ( is_category( ‘cat i.d or name goes here’ ) ) {
    echo ‘<div class="before-category">’;
    dynamic_sidebar( ‘before-category’ );
    echo ‘</div><!– end .before-category –>’;

    }

    }
    [/php]

    Here the hook has been changed from genesis_before_loop to the genesis_before_content_sidebar_wrap position.

    The conditional tag has also been changed from is_page() to is_category()

    The name or i.d of the category goes between the brackets. (’007′) or (‘yourcategory’)


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

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

You must be logged in to reply to this topic.