Support » Plugin: Genesis Portfolio Pro » How to add another folder to template hierarchy

  • Hi there,

    I´m trying to overwrite the archive-portfolio template. I´m using the Business Pro-Theme by SEOTHEMES. This child theme already has a file called archive-portfolio.php. Now I want to overwrite this file with my own custom archive-portfolio.php so that I don´t have to risk being overwritten with the next theme update.

    As far as the plugin loads the template hierarchy and checks if a template is located in the theme folder before loading the template from the plugin directory there must be a way to add another location which should be checked first…like a subfolder in the child theme called “custom-templates”.

    I already tried a lot of different things including different versions of the template_include filter….like that:

    add_filter( 'template_include', 'be_template_chooser' );
    function be_template_chooser( $template ) {
    	if ( be_return_archive_section() ) 
    		
    	  	//$template = get_query_template( 'archive-' . be_return_archive_section() );
    	  
    	   	$template = get_stylesheet_directory_uri() . '/custom/archive-' . be_return_archive_section() ;
    	
    	return $template;
    }

    I tried to put the code in the functions.php but it seems that it doesn´t really overwrite the code in the plugin (maybe because being loaded to late).

    Does anybody know how to achieve the desired result? In the end the idea is to have a setup similar to a grand-child theme.

    Any help is really appreciated!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Child themes are not meant to be upgraded and do not get upgrade notifications by default.

    Upgrading the child theme would remove all your customizations. Only genesis gets upgraded as it has all the security updates and WordPress compatibility.

    Any updates you see to child themes are there for use on new sites with a new install of the theme. These updates are listed in the changelog in the readme.txt in the child theme folder, and are often minor css fixes or spacing issues.

    Grandchild themes are not really supported in WordPress.

    Hey Andrea,

    thanks a lot for your comment and explanation. I know that grandchild themes aren´t really supported and that it´s a bit complicated to find the best setup in each individual case. I like to keep the files of a child theme untouched so that it´s possible to update it without any problem. Especially if you are using and maintaining a child theme for a long time that really pays off because sometimes it really takes a lot of time to track and change all updates manually. Therefore I´m using plugins like “Code Snippets” and individual additional folders to stay safe and keep away from that kind of problem. In most cases this works fine without any problem but sometimes it´s a bit tricky to find the right way to “inject” your individual stuff.
    As far as the template hierarchy is changed in the plugin I was in good hope that it´s possible to add another template location using the template_include filter. That would be it a lot more flexible. If I understand you correctly this isn´t possible and it´s only possible to make use of the “default” template locations and change the order of checking them.

    Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to add another folder to template hierarchy’ is closed to new replies.