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
- Add 2 links in between the navigation using the Breadcrumb Navxt plugin hook
- Possible to overwrite load_template function in plugin using functions.php
- Re-use date format on different template
- Modify a function without editing template
- Executing my function once on a specific time
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Get posts from WP_Query and format them on admin_head
- Missing Argument
- load_plugin_textdomain error
- Automatically add attributes to woocommerce product?
- WP Post Template – Templates in own folder
- How to override a plugin function wrapped in a class?
- Bootstrap Drop Down menu is not working
- Register Page Template from Plugin
- How to Display a Plugin function (content) on frontpage using index.php
- Any hook for pre-plugin-update -either bulk or single plugin update
- Insert new user with form submit ‘init’ hook
- Theme my Login plugin, how to update fields
- Edit Yoast SEO breadcrumbs output [closed]
- Adding Shortcode to Text Widget
- Date calculations from 2 custom fields
- When to load auto-login code?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Custom random quote widget breaks when used in multiple sidebars
- List Category Posts rewrite necessitates rewrite of customised templates
- How to get all of the activate_plugin action parameters?
- Using a function to change favorites listing
- Display post lists in 2nd paragraph
- How to debug error message: Cannot modify header information
- Using a post-signup hook to get user details
- How to enable specific plugin only based around shop manager role?
- How to change constants in WordPress wp-config.php programmatically?
- Restrict media upload size by format
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- 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]
- How to display custom sidebar in wordpress 5.5.2
- Show function to super admin
- How to check current user before all actions and filters?
- (FES EDD) New vendor submission page is blank
- Plugin-generated pages use Not Found or Pages Archive templates?
- creating html reusable blocks via shortcodes
- get current date + 90 days and checking every day
- Adding a new field to the address field type in gravity forms
- Replacing a plugin function with a custom renamed function doesn’t work
- 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]
- Get Time Taken By Each Action Hook in WordPress
- How to create an input field, and base the output on spreadsheet data? [closed]
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Nested shortcode functions accessing variable
- Advanced Custom Field DatePicker [closed]
- Calling an attribute from a plugin shortcode
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- How to call WordPress function other files
- Removing an action from wp_footer called in a class that’s inside a bigger class
- Use of Templates in a Plugin
- Add comments for template variables
- Plugin developer automated documentation
- All sites themes functions.php have been changed
- Custom plugin init action causing general slowness
- Customize permalink wordpress category id
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- Conditional attributes and logic per product category
- Disqus deleted comments are syncing with wordpress but active comments do not
- Admin style for just one plugin in dashboard
- add_action in static class [closed]
- WordPress user account activation
- WP Query. Is there a maximum size?
- Render custom php template into string
- How to remove custom post type and add category and post name
- Perform internal redirect in WordPress?
- How WordPress is able to change locale without using setlocale
- External Script Using WP – Hooks / Actions Not Working?