• Resolved 20101012

    (@20101012-1)


    I currently have a pretty basic WP setup, and am using the “List category posts” plugin to display all posts per category on a simple page here:

    http://oracle101.co.uk/all-posts/

    I wondered if there is any way I can edit the category archive functionality so that instead of displaying the full content per post, it just displays a simple list of posts per category – e.g. so this:

    http://oracle101.co.uk/category/sql-general/

    Displayed the same type of layout as its counterpart of the all-posts page, with e.g. an <h3> title for the category name, and then links to each post in a simple list:

    SQL General

    • Connect By Examples
    • Dummy Data And The Dual Table
    • Oracle vs ANSI SQL Syntax
    • Schema Browser SQL
    • SQL Like – Percent vs Underscore

    Any advice much appreciated.

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi –

    The layout and output of the different types of pages is determined by different “templates” being used for the complete listing, archive, and single posts.

    It looks like you are using a child theme, so changing the template file for the archive pages is pretty straightforward, if you are reasonably comfortable with code, that is.

    Please let me know if you’d like instructions on how to do this yourself. (It will require that you copy/paste/delete the template files in your child theme.)

    Hope this helps.

    Thread Starter 20101012

    (@20101012-1)

    Hi Diana – thank you for your reply.

    Yes, I am using the Bootville Lite Theme, and have created a Child Theme of it. The theme did not contain a “category.php” file, so I copied “archive.php” and renamed it as “category.php”.

    I have experimented with creating my own template file, as exists on this test page (http://oracle101.co.uk/category-archive/), which is linked to a “Category Archive” Template but I didn’t get very far with that route!

    If you have time to send through some instructions please, I would really appreciate it. From what I’ve seen by reading on the web, some advice says I need to create a template file for each category, which sounds quite labour intensive.

    Thanks very much

    Jim

    Jim –

    First, I tried to access your site this morning and am getting an “Account Suspended” page, so it’s a bit more difficult to give you precise instructions.

    Generally, though, you are doing great, and are on the right track. You can use either category.php or archive.php, and no, you don’t need a template for each category unless you are styling them differently.

    This chart on this page is invaluable in dealing with WordPress templates: https://developer.wordpress.org/themes/basics/template-hierarchy/

    It may look confusing at first, but shows the order in which WP looks for templates. Everything defaults to index.php, unless there is a more specific template.

    As you can see, category comes before archive, so it will be used if it exists, and if not, archive will be called.

    Long story short – you can use either.

    As to how to style it like the first page: simply copy the content of the template being used by that page, and name it archive.php (or category.php)

    If you are not sure which template is being used, there’s a great little plugin called What the File that will tell you. https://wordpress.org/plugins/what-the-file/

    And please feel free to ask if you have more questions.

    Thread Starter 20101012

    (@20101012-1)

    Hi Diana – thank you for your help 🙂
    You’re most kind.
    Jim

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Edit Category Archive Behaviour’ is closed to new replies.