• Resolved Oooh Boi

    (@ooohboi)


    Hi,

    I’m trying to overwrite my theme’s “archive.php” with the Pods auto template. How do I do that by using the custom filter/hook?

    Here’s my WP “archive.php”

    /**
     * The template for displaying post archives with Pods
     */
    
    get_header(); 
    					
    if( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'archive' ) ) { 
    	
    	do_action( 'my_custom_hook' );
    
    } 
    get_footer();

    … and here’s the Pod category setting:

    View post on imgur.com

    I’ve got the Pod Template created!
    What I don’t understand is how to define the custom hook.
    As a side note, I’m OK with using get_the_archive_description as a template filter but I don’t understand how to implement this one as well.

    Thanks for any tip!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @ooohboi

    Pods doesn’t really overwrite the archive.php template, it hooks into the Posts loop of an archive page.

    If you need changes outside of the posts loop you’ll still have to edit the actual archive.php file!

    Cheers, Jory

    Thread Starter Oooh Boi

    (@ooohboi)

    Pods doesn’t really overwrite the archive.php template, it hooks into the Posts loop of an archive page.

    Yes I know it doesn’t, that’s not the problem.
    My question was HOW it DOES?

    I was able to “overwrite” the single post template without any problem bcoz Pods got hooked on “the_content()”.

    But with the archive template it doesn’t do that on the_archive_description() nor the custom do_action() hook.

    So the question is how things work with the “archive.php”, either the the_archive_description() or the custom hook?

    The code example would be appreciated.

    Thanks a lot for taking time on this one!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @ooohboi

    If the theme doesn’t provide a default action you can use for archives (eg: the_archive_description or something similar) you’ll have to add it yourself manually.

    You can do this simply by adding the_archive_description() or do_action( 'your_custom_action' ) where you want.

    I always advice to create a childtheme first!

    Cheers, Jory

    Thread Starter Oooh Boi

    (@ooohboi)

    But the problem IS that neither of these two work Jory!!!

    “the_archive_description()” doesn’t get replaced at all with my auto template.

    As a side note, I have some WP experience (8 years), I’ve made some plugins and themes so I’m not a total noob.

    Could you post the simplest possible “archive.php” code here?
    Maybe I’m missing something obvious with regards to the Pod settings but I’m trying to figure out the logic behind it for over a week.

    Thanks!!!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @ooohboi

    I’m very sorry but it seems you’ve stumbled on a bug!
    Not only that, an already reported but after I searched for one.

    Bug report: https://github.com/pods-framework/pods/issues/6368

    I also just created a patch to fix it! I you could apply it and let me know if it also works for you that would be great!

    Pull request: https://github.com/pods-framework/pods/pull/6490

    Cheers, Jory

    Thread Starter Oooh Boi

    (@ooohboi)

    OMG! That was a real nightmare buddy, I thought I was losing my mind…

    YES, I can confirm that the patch works now! Please push it with the next update.

    Thank you very much for understanding!!!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @ooohboi

    I’m sorry to put you through that! I honestly though this was “just working” as I remember creating this. However, since that feature there have been several patches for other bugs and one of those must have caused this one without me realizing.

    The next release will contain this fix! It’s already merged into the code ??

    Cheers, Jory

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Auto template for the archive.php’ is closed to new replies.