Thanks to @WebElaine’s comment. I needed to move the template return outside of the function so that it looks like this:
public function add_my_template($template){
if ( is_page( 'my-unique-page' ) ) {
$template = plugin_dir_path( __FILE__ ) . 'page-my-unique-page.php' ;
}
return $template;
}
Related Posts:
- Autogenerate wordpress shortcodes using array?
- Shortcode display outside the div
- How to remove action from plugin?
- How to stop or remove an action being called inside a function of an extended class
- wordpress plugin is not activating from widget
- Calling plugin function inside custom plugin for onclick event
- Facebook Messager Plugin
- What is @Action in WordPress?
- Create a post builder skin in a plugin
- Plugin Development – Functions or Hooks?
- Are there action hooks for comments?
- How to remove a class function from a plugin by using remove_action()?
- Add action to custom Function
- the_posts_pagination() not working if I add wp_head() to header.php
- The function called on the wp head hook becomes null
- Sharing varible between two add_actions
- How to Unhook actions/filters in within Class in plugin
- WPML – Hook when language is switched (change user language)
- Call function with button and return response
- Use action, filter, or hook to append HTML to WordPress plugin function
- How to echo a plugin’s function into a template?
- how to repeat taxonomy in different places on wordpress
- AJAX login without a plugin does not work. when add a action to function.php
- add query string to all pages after user logged in
- Call a function with href
- Plugin update error message
- How to handel multiple checkbox field in the admin settings page with Settings API
- wp_insert_user – how to send verification email before logging in
- Set a User as Author of all ‘New Posts’ posted
- Post source link plugin – small modification
- Which hook callback has priority if both plugin and theme use the same hook?
- Use external link in the add sub menu
- delay function on publish?
- What is the function to get plugin base url in multisite?
- Code in theme functions.php faster than with a plugin?
- Can a plugin add to header/footer/body content?
- Creating a wordpress plugin where users can override templates
- Override the core function locate_template
- Trying to count the total number of paragraphs inside a blog article
- How to get post URL in the_content filter?
- add action for displaying posts using a shortcode
- May i Use ShortCode in Template?
- Pass info from functions.php to plugin
- add_query_arg not working
- Inserting HTML tag with ACF into shortcode
- WordPress filter that hook after each action/filter hook
- How to Display a Plugin function (content) on frontpage using index.php
- Theme my Login plugin, how to update fields
- WordPress comments not appearing in blog posts, likely because of Redux template. Could I fix this with a plugin that adds a comment form as a block? [closed]
- get current date + 90 days and checking every day
- How to display (plugin?) output on a single page (not a widget, probably not a short code) – template, plugin, combination?
- CampaignMonitor for WooCommerce – Move subscribe button [closed]
- How to create an input field, and base the output on spreadsheet data? [closed]
- Advanced Custom Field DatePicker [closed]
- Customize permalink wordpress category id
- Admin style for just one plugin in dashboard
- How to set Noindex to all wordpress pages in a catergory?
- How to get post ID with hooks publish_post, new_to_publish, etc
- Load Javascript from Plugin in One Page Only?
- How to keep variable `$post` to using in another file
- the_post hook is not firing for me
- do_action Nested List
- Where to find the code used to render a page that has a shortcode and a template defined?
- How to create Admin Notice from Plugin with argument? [duplicate]
- wp_dequeue_script for a Plugin
- Overriding an Array in a Plugin’s Class/Function from functions.php
- How to use template inside plugin shortcode with variables for big HTML code
- Change Header (Logo) Based on Login
- How can i list random author?
- Can you echo PHP code from a variable?
- Defining the value of a variable before a function?
- How to get custom minimum price in Woocommerce
- Dynamic URL Rewrite for Custom
- how to validate input field in wordpress generated with wpform plugin
- Error using wordpress functions inside a plugin class
- Submitting form to PHP
- How to detect 404 url and make this link underline or change background color?
- How use get_plugin_updates() function?
- how override a define
- Nested Actions and Filters
- Change Jobs for WordPress templates
- how to do Thematic like this website using wordpress?
- How to disable/enable a plugin at a specific time
- Dynamically Modify s2member Options
- What action or filter can I use to change all the html returned from server for a page?
- Unexpected plugin_dir_path Output
- how to create table during plugin installation in side a class
- Convert HTML5/CSS3 site to WordPress Theme (need a lot of plugins) or just use the API?
- Metabox Data not saving
- Removing this filter added by a plugin
- Which filters or actions involve with index page for plugin?
- Can’t get custom user meta to show in header
- Including a PHP file via a function that is part of a plugin?
- WP Members additional fields on user profile [closed]
- WooCommerce Order Status Displays Twice on Order Page
- Integrate Razorpay quick payments plugin with contact form7 plugin
- My wp_update_nav_menu action is firing twice
- How to Allow Users to Select Recipients In a WordPress Comment section?
- Event Made Easy – Block registration to two or more events that have the same category
- I want to allow certain file types on dokan upload files