Coder Social home page Coder Social logo

Comments (1)

iamwebrocker avatar iamwebrocker commented on May 29, 2024

Thank you for this issue.
I really felt stupid, since in the functions.php of the theme the use of a child theme is encouraged, and then one of the (to me) simplest use case -- create a custom page template to include output coming from some AFC fields -- just didn't work.
I pulled several hairs, until I found this and the other closed issue #610 with the discussion.

Now, after looking at this function, I was able to add "my" template via the filter hu_content_map in the function.php of my child theme:

function hueman_child_content_map() {
	return array( 
	   // the original templates:
	   'tmpl/index-tmpl', 
	   'tmpl/archive-tmpl', 
	   'tmpl/page-tmpl', 
	   'tmpl/single-tmpl', 
	   'tmpl/search-tmpl', 
	   'tmpl/404-tmpl',
	   // my template:
	   'tmpl/page-custom-tmpl' 
	 );
}
add_filter('hu_content_map','hueman_child_content_map');

The solution is simple: make the hu_is_authorized_tmpl pluggable.

Since the filter works, I don't think a change of the original function is needed for that template use case.
But, maybe the filter should'nt replace the original templates array, but merge with whatever one wants to add to that.
Currently using the filter without also stating the original templates would remove those, which isn't such a good idea, I'm arfraid.

Cheers!

from hueman.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.