Is Template-specific metabox creation possible?
-
Hello,
This is an outstanding plugin; thanks to everyone involved in its creation and maintenance.
QUESTION: Currently my call to new_cmb2_box() is located in functions.php. Suppose I have a site with ten different Page Templates …each of them needing a unique set of 3 or more CMB2 metaboxes, each with its unique ‘name’ and ‘description’. If the code for all this were to be located in functions.php, the calls for creation of the metaboxes for each template would require perhaps 50 lines of php code (or more depending on the number of metaboxes) per Page Template …so the sum total could get very large.Is there a way to include the calls to new_cmb2_box() in Page-template-specific files so that that the code isn’t even executed if a visitor doesn’t visit a Page using a specific Template? I’m thinking, of course, of the potential impact on site speed as lines of CMB2 code are added in such an unusual situation.
Thanks!
Patrick
- The topic ‘Is Template-specific metabox creation possible?’ is closed to new replies.