Metabox `page_templates` working incorrectly
kprovance opened this issue · 7 comments
Transfer from: https://github.com/reduxframework/redux-extensions/issues/400
Metaboxes page_template
show/hide failing. It looks as if WP changed the classnames in Gutenburg again.
Will test more broadly next week.
And my other question? Are you using the Gutenberg interface or the classic editor? On Sat, Oct 12, 2024, 3:51 PM reduxframework/redux-extensions via Redux.io @.> wrote:
I didn't quite understand the question.
If about the core of WP, then I use the Gutenberg interface.
Versions of WP and Redux, the latest
Metabox - a simple text field
I need to make a metabox only on ONE given page, for example, a separate page template ( page-contacts.php ).
Using this code
Redux_Metaboxes::set_box(
$opt_name,
array(
'id' => 'tpl_box',
'title' => esc_html__('Metabox', 'lisnic'),
'post_types' => array('page'),
**'page_template' => array('page-contacts.php'), //page template**
'position' => 'normal', // normal, advanced, side.
'priority' => 'default', // high, core, default, low.
'sections' => array(
array(
'title' => esc_html__('Metaboxes ', 'lisnic'),
'id' => 'tpl-fields',
'icon' => 'el-icon-cogs',
),
array(
'title' => esc_html__('Info', 'lisnic'),
'icon' => 'el-icon-cogs',
'id' => 'tpl-contact',
'subsection' => true,
'fields' => array(
// field
array(
'title' => esc_html__('test ', 'lisnic'),
'id' => 'tpl_prc',
'type' => 'text',
),
),
),
),
)
);
The metabox appears on ALL pages.
What am I doing wrong, where is the error?
Thank you.
Please be aware, this is NOT how we normally do support. In an idea case, there is a form to fill out with required information past "latest versions" which tells me nothing. I cannot use your sample code as I do not have your theme or your templates.
It seems WordPress changed the class name of the page template popup, again, so I added it to Redux and tweaked the code a bit. Please download the version from this repo to try it. v4.4.18.9 beta.
Good day.
I tried the beta version, with it the fields are missing on all pages. (with the working line 'page_template').
If necessary, specify the address with the form for filling in the necessary information, I will fill it in there.
The question is not urgent, I would like to understand this point if possible, because a similar question often appears in the search.
And your redux is a very cool product, and if we solve this problem over time, many will benefit.
Thank you.
Please post a copy of your theme. I will never figure this out based on guesswork as my sample config works perfectly.
I tried to replicate your code the best I could without having your theme files. The reason you are seeing a blank page is because of this block
array(
'title' => esc_html__('Metaboxes ', 'lisnic'),
'id' => 'tpl-fields',
'icon' => 'el-icon-cogs',
),
That is creating an empty section with nothing in it. Either remove it or add some fields to it.
As this is not a Redux bug or issue, I am closing the ticket. Because we have a docs site, we don't offer free support for theme development. That is a premium service.
Thanks for your response.
I will use your recommendation.
Thanks for your time.