• Hi all,

    I would like to modify the categories page. Now it displays posts excerpts when a category is clicked.

    I’d like to display a page that introduces the category when the category link is clicked. Below this paragraph of introduction will be the same posts excerpts.

    The best solution I found was the ‘Category Page’ plugin. This plugin connects each category with a page, but it hasn’t been updated, so it doesn’t work anymore. Does somebody know how to fix this? Can somebody help me with this? (paid if necessary)

    I also read this post but isn’t it possible to connect a page, so you can easily configure the page?

    Thanks so much,
    Josh

Viewing 1 replies (of 1 total)
  • This is the section I suggest using
    http://codex.wordpress.org/Category_Templates#Different_Text_on_Some_Category_Pages

    It sounds like the only issue you have with that method is you’d like the content for each category description to be dynamic, so you can change it within the WordPress editor environment. You could do that by, instead of hard coding the description in the category.php template, by including the post or page content of another post or page within the category description area.

    If you want to use pages, you will code the post ID# of each page you want included in the category.php template

    Instead of this

    <?php if (is_category('Category A')) { ?>
    <p>This is the text to describe category A</p>
    <?php } elseif (is_category('Category B')) { ?>
    <p>This is the text to describe category B</p>
    <?php } else { ?>
    <p>This is some generic text to describe all other category pages,
    I could be left blank</p>
    <?php } ?>

    something like this (this code likely needs tweaking and I made up the post ID #’s as examples):

    <?php if (is_category('Category A')) { ?>
      $page_id = 112;  // post ID of page with Cat A descriptive text
      $page_data = get_page( $page_id );
      echo $page_data->post_content;
    <?php } elseif (is_category('Category B')) { ?>
      $page_id = 137;  // post ID of page with Cat B descriptive text
      $page_data = get_page( $page_id );
      echo $page_data->post_content;
    <?php } else { ?>
       <p>This is some generic text to describe all other category pages,
    It could be left blank</p>
    <?php } ?>

    That outputs raw page content. It may need to be run through WP filters. If you try this method and the content is not complete, post back here what is missing.

Viewing 1 replies (of 1 total)

The topic ‘Modification categories’ is closed to new replies.