Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #231796

    cnever
    Participant

    Hi

    I would like to customize the archive template in X, maybe the search result as well, I have a feeling they are the same page. Is this possible with child theme setup? All I need is the file location it gets drawn from so that I can add custom html/ccs/php, this is not following the same structure as default wp I think?

    Thanks

    #232109

    Rad
    Moderator

    Hi there,

    Thanks for writing in.

    Archive, tag, search, blog index and all types with no existing template are default to use index.php. Which means, you can duplicate index.php and renamed it to archive template.

    More explanation here : https://theme.co/x/member/forums/topic/create-page-for-one-category-in-blog/?replyto=221040#post-221386 , https://theme.co/x/member/forums/topic/custom-post-templates/#post-232039

    If you’re familiar how wordpress’s template hierarchy works, then what’s left is to understand how X’s template parts works by using x_get_view() 🙂

    Thanks!

    #233233

    cnever
    Participant

    Hi

    Thanks for the input and help although I am struggling. It has to do with all the different folders that makes this difficult to figure out plus the child theme on top of that. I have it as follows (I am in integrity so ignore the other stacks)

    To create a page that will output when the portfolio category is viewed I need to create:

    Framework > views > integrity > wp-category.php — In this file you call the global _category.php which is in
    Framework > views > global > _category.php

    The problem is the index.php still outputs. I know I am doing something wrong and that is why wp is defaulting back to the index page but not sure where? It didn’t make sense to put a category.php file in the global folder due to the index calling index. In default wp you have the category.php file in the root so it looks for that category.php file. It seems with X you need to call the file with a category file? Am I on the right track. It would be great if you have some kind of pdf explaining how X run’s through its structure like WP does 🙂

    Thanks for any help in advance!

    #233376

    Zeshan
    Member

    Hi there,

    Yes, in order to create a portfolio category archive page, you need to create a template file in the main directory of your child theme. As mentioned in our previous responsive, X uses index.php file as a default template file for all types.

    So, in this case, what you can do is to create a template file for your portfolio category page by following the correct template file name from WordPress Template Hierarchy for custom taxonomy. For example:

    if you want to create a template file for portfolio category “California”, you need to create a file named taxonomy-portfolio-category-california.php file in your main child theme directory. After that, you can copy the code from wp-content/themes/x/framework/views/[your_stack]/wp-index.php file and paste into the newly created file. Then, you can make your desired changes and save the file.

    Hope this helps. 🙂

    Thank you.

    #233390

    cnever
    Participant

    Hi

    Many thanks! I figured out why my files did not work. Due to me using the portfolio part as a products list I thought the custom slug that was created with the customizer will be what wp will look for in the file structure, but it still looks for the portfolio part in the name. Pulling my hair out but thanks working now! Trying to get all the words that say ‘portfolio’ to change it to product will be my next step. Will make things a lot easier 🙂

    But thanks a lot your input guided me to fix it!

    #233429

    Nico
    Moderator

    Glad to hear that you figured it out!

    Let us know if you need anything else.

    Cheers!

    #329262

    rsmith4321
    Participant

    Thanks, this is just what I was looking for.

    #329416

    Lely
    Moderator

    It’s a good thing that this helps you.
    Do let us know if you still have questions.