[Resolved] Customise Archive.php

Home Forums Support Customise Archive.php

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1055048
    Samuel

    Hi,

    I looked into this for hours and can’t find a way to customize my archive.php file as needed.

    I need my category pages to look like a classic page with :

    1 / Hero Header with Title and featured image.
    2 / A content part that I can edit to put some text to explain what this category is about and where I can add a shortcode to display all posts of this category with filter (I use “The Grid” plugin to do that).

    Is there a way to customize archive.php to display like page.php backend and frontend ?

    I tried to copy my page.php file and plage it on my Child Theme and rename it archive.php but obviously it does not work… I really don’t know nothing about PHP and I’m just following step by step tutorials to modify things when needed.

    1 / Regarding Header
    I tried to use Element to customise Header of “All archives” but nothing happened. Even just a color change attribute. So it’s weird but anyway there is no option to put a featured image on category backend, so I think Element can’t do more about this ?

    2 / Regarding Content
    There is a “description” field that is not displaying frontend. But maybe there is a way to display it ? In that case it could be a solution to solve part of the problem BUT I would need to be able to style the text and display my shortcode in it… w

    Could you help me with all this ?

    My website is actually running on local.

    Thanks a lot !
    Samuel

    #1055382
    David
    Staff
    Customer Support

    Hi there,

    may be simplest for you to redirect category archives to a static page, then you can do as you please with the content. This article explains how to do that:

    https://docs.wpshowposts.com/article/use-static-pages-as-category-archives/

    #1055685
    Samuel

    Thanks David, I was thinking about that very simple idea indeed ! But I was wandering if it has no side effects regarding SEO or “Google undestanding”. Anyway I think I will follow your advise.

    #1055786
    David
    Staff
    Customer Support

    No side effects SEO wise as any Category links will redirect to your custom archive page which is what will get indexed by Google.
    The only ‘negative’ is you have to build them manually for each category and make sure slugs match. So a little more hands on.

    #1055797
    Samuel

    Thanks David !

    #1055802
    David
    Staff
    Customer Support
    #1096247
    Samuel

    Hello back ! I was wondering if same feature was possible with tags ? Thanks for your help

    #1096592
    Tom
    Lead Developer
    Lead Developer

    I’m not sure if that’s possible (never tested it). You could try replacing category_name with tag_name in the code.

    #1096721
    Samuel

    Hi Tom, thanks for your reply, this is sadly not working, I will have to make all my tags to be categories, do you know if there is a hook to do so automatically or do you recommend to handly redirect 301 every one of it ?

    #1097170
    Tom
    Lead Developer
    Lead Developer

    What about just using tag instead of tag_name?

    #1097619
    Samuel

    It’s working ! Thanks Tom

    #1097953
    Tom
    Lead Developer
    Lead Developer
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.