I’ve had this problem in past
try using include
with locate_template
:
I don’t exactly remember the reason but this code still works:
Example:
include(locate_template(YOUR_TEMPLATE_PATH));
Here’s a complete demonstration too, using the same idea, if you need more help.
For Admin Panel
include
simply works in admin panel.
You might want to modify your code like:
public function init(){
add_menu_page( 'Your Plugin Name' , 'Your Plugin Settings' , 'manage_options' , 'your_plugin_settings' , array( $this, 'settings_page' ) );
}
public function html_page_template(){
ob_start();
include('views/view-settings.php');
$html = ob_get_clean();
echo $html;
}
If the init
function is calling your custom hook, then please don’t modify it and make sure that code is working properly. Your html_page_template
function should now output the form.
Related Posts:
- get_template_directory_uri pointing to parent theme not child theme
- Include PHP file in Content using [shortcode]
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- What is the most efficient method for loading widgets in functions.php
- PHP files included in functions.php don’t seem to work
- Include files in child themes, declare in functions.php
- using `require` in my functions.php breaks the site
- Calling a Function in Functions.php from an external PHP script
- Automatically include all php files in a child theme directory
- Can I have an additional functions.php file in WordPress?
- wp_star_rating() – Adding a 5 star rating system to theme
- Unable to point the child theme directory even using get_stylesheet_directory()
- Can I include a custom PHP function in a WordPress function?
- file.php not loaded?
- Why should I use get_template_directory() when include files?
- WordPress functions.php conditional include another functions file
- Including admin-options.php file in Child Themes
- Undo a function that is not (seemingly) hooked to an action?
- Solution to render Shortcodes in Admin Editor
- How to run a function every 5 minutes?
- Upload Multiple Files With media_handle_upload
- Add custom template page programmatically
- Modify Admin Bar Link
- How to override admin-bar style
- Woocommerce add to simple product attribute programmatically [closed]
- WP 4.4. responsive loads normal image after loading the responsive image
- How can I tell if I’m on a login page? [duplicate]
- Get Category and Excerpt From wp_get_recent_posts
- Two different menus for two different locations?
- Error after editing functions.php
- How do I properly register bootstrap JavaScript into WordPress functions.php?
- Function to Download External Images to My Site
- Manipulate Output of wp_list_something: select menu instead of li’s
- How to call a function on particular page like ‘contact-us’ from function.php of child theme
- how to fix Warning: Use of undefined constant _ – assumed ‘_’ (this will throw an Error in a future version of PHP)
- restore_current_blog required after switch_to_blog, if I use that in a function?
- ‘is’ functions and ‘get_query_var’ not working
- How Can I Expand the WordPress Customize window without any Plugin?
- “is_new_day()” alternative for years?
- How to hide a plugin metabox for non admins when a user adds a new post
- Getting Featured Image Caption to Only Show if Populated
- How do I create page navigation linking to each H2 within the page? [closed]
- Allow Post Author to be 0 on Update
- How can I make a widget shortcode to control all the widgets?
- admin-ajax.php + load-scripts.php hanging for minutes
- Display ‘BuddyPress Follow’ follow button to non-logged in users [closed]
- Unique sequential reservation code
- Show image exactly defined to a width
- wp-admin won’t load after setting wp-login custom url
- How to know if user logged in
- Option Tree integration of Custom CSS
- Remove “Published On” inside wp-admin
- Can’t call Javascript function – scope?
- Deprecated function get_user_by_email($email)
- header_image() with CSS
- Shortcode parse error – wrong syntax
- Why does get_template_directory_uri() not include “www”, only for enqueued stylesheets?
- Getting commenter meta
- Run a jquery script on on a certain template page
- How can i unload effect.min.js file?
- Native gallery custom html output
- Can’t add_action to ‘save_post’ and get it to fire
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- why is this function firing on all child menu items as well?
- Custom styles in Tiny MCE with an external CSS file
- I changed Functions.php and now I get “cannot decode raw data NSURLErrorDomain:-1015” (not blank)
- How to load jQuery in TOP of wp_footer?
- How to fetch custom post type by variable date?
- Use add_action within template
- two search forms on the same page
- Getting out side of wp root folder from function.php using absolute path
- Changing the header image using WPML
- current_page_item is missing inside wp_nav_menu
- Change default upload images size for contributors
- Strange error from functions.php files (wp_register_script)
- How to setup a popup registeration page in wordpress with function.php
- How to add if statement on WordPress shortcode output
- Why does modifying the “read more” link remove the link class?
- How Do I Unhook This Parent Theme Function?
- Woocommerce product price change
- Allow user only create specific tags
- How to create an array if ’empty’?
- How to display different blocks for mobile and desktops
- Woocommerce – Switching Price for Category
- Help wiht adding fullcalendar.io to a WordPress page
- WP Enqueue Script Error
- Enqueue JS + CSS via a child theme functions.php file?
- How to create a WordPress Customizer Button to Clear a Cache?
- Move product attributes after summary on single product page
- Javascript and Stylesheet in child page
- How to add number to wordpress count function?
- Custom Nested WordPress Comments with avatar
- Having problems loading Jquery in functions.php
- Functions file mods and CPU
- How can I append and prepend something to all post hyperlinks without using ::before or ::after? PHP hook solution?
- How to overwrite ‘read more” text for artmag theme
- How to display milliseconds instead of seconds using timer_stop function? [closed]
- Retrieving next_post_link() and previous_post_link() in functions.php
- Customizer cuistom CSS Priority ordre Issue
- WPDB query suddenly not working