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 2 years, 6 months ago.

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


    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?





    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.

     * Add archive page title and description
     * @author Yoast
     * @link <a href="http://yoast.com/wordpress-archive-pages/" rel="nofollow">http://yoast.com/wordpress-archive-pages/</a>
    function yoast_term_archive_intro() {
      if ( !is_category() &amp;&amp; !is_tag() &amp;&amp; !is_tax() )
      if( get_query_var( &#8216;paged&#8217; ) )
      echo &#8216;&lt;h1 class=&quot;entry-title&quot;&gt;&#8217;.single_term_title(&#8221;, false).'&lt;/h1&gt;';
      echo &#8216;&lt;div class=&quot;entry-content&quot;&gt;&#8217;.wpautop( term_description() ).'&lt;/div&gt;';
    add_action( &#8216;genesis_before_loop&#8217;, &#8216;yoast_term_archive_intro&#8217;, 20 );

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



    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.


    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 –>';

    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’)

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

You must be logged in to reply to this topic.