theme_page_templates Not working.
-
I am developing a plugin for Wordprss. When I activate the plugin, I want to add a page template. When creating a page with dropdown, I should select the page template and create the page.
I found out that I need to use the following code, but the page template is not enabled even though the page template name appears in the dropdown.
add_filter( 'theme_page_templates', 'filter_inject_page_templates' ); function filter_inject_page_templates( $templates ) { $path = plugin_dir_path(__FILE__).'templates/template-landing.php'; $templates[ $path ] = 'Template Landing' . $path; return $templates; }
I need help urgently. Thank you very much, everyone.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘theme_page_templates Not working.’ is closed to new replies.