Instead of using page templates to define layouts, define layouts using custom post meta. The custom post meta can then be shown or not shown using is_plugin_active().
If you’re going to define the page template itself in the Theme, then you’re pretty much stuck with doing something like determining if the Plugin is active (which, on the front end, should be done using a function_exists() conditional or something similar), and including the default template if not. For example:
/**
* Template Name: Shop
*/
if ( ! function_exists( 'some-woocommerce-function' ) ) {
get_template_part( 'page' );
} else {
// Shop template markup goes here
}
That way, even if the template is selected, it will gracefully degrade.
Related Posts:
- Check if a menu is empty?
- page template for attachement page?
- Showing content from one page on another
- Populate editor with some content of a page with a page template
- WooCommerce Tabs [closed]
- Inject class in body when particular page template is used
- Adding wrapper elements in the_date() like in the_title()?
- Show meta box only for default page template
- Contain multiple page templates in one PHP custom template file in WordPress?
- remove_action() not working in page template – Genesis
- Calling PHP function doesn’t work in index.php
- Display custom meta box in my template file
- Loop on a wordpress Page instead of content coming from the WP text editor
- Adding ads code between comments
- How to check If Oembed is empty or not
- WordPress Redirect: Default Password Reset URL [duplicate]
- Add before_content and after_content to register_sidebar
- Making Quote Plugin more efficient
- How to access function from outside of a class within this class in WP plugin?
- wrong php date()?
- Scope for PHP Variables Assigned in functions.php or a plugin
- Sort registered users by post count? (inside admin dashboard)
- What is the fastest way to load PHP functions that are only used in one theme template?
- How to speed up admin-ajax.php in wordpress
- My Own layout in WooCommerce pages [closed]
- Getting rid of role=”navigation” in the Home Page Pagination
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- How to get post URL in the_content filter?
- Include a php file from functions.php only to homepage
- GravityForm: Populate Dropdown with custom post type [closed]
- Add a plugin before main container
- How to get subscription key or id using Woocommerce Subscriptions [closed]
- Placing raw HTML inside a WordPress shortcode
- Woocommerce – remove product from category
- How to use return in my custom function instead of echo
- Differences when using the the_time and the_date functions
- Create Logout Link WordPress Admin Menu
- Word Count Function Preventing Permalink Editing
- Add a Second Menu to a theme that only support 1 menu
- Changing the template hierarchy
- How to speed up a wordpress function with multiple loops?
- How to Display Image Meta underneath EVERY image in EVERY post
- WP_cron won’t trigger my action
- Custom excerpt function re-factoring
- Missing argument 3 for wp_register_sidebar_widget()
- PHP can I add line numbers to file_get_contents()
- Adding tawk.to code just before body tag on functions.php file
- How to change a public function inside a class of a plugin?
- How to enqueue CSS and JS only on specific template?
- get_the_terms – only top level
- syntax issue on php 7.4
- How do I fetch all comments per post via WP REST API?
- How do I publish only one page to production after making changes on staging?
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Changing Woocommerce flat rate every nth number of items
- Shortcode content output but not in correct place
- Use wp_get_recent_posts with search term
- Convert all images to PNG on file upload
- Custom Template 404 for specific custom post type
- How to restrict page access to logged-in users?
- Remove query string specific key value
- is_page “range” for if statement?
- Calculations in functions.php [closed]
- If search results empty then execute certain code
- Shortcode return function with link href inside PHP
- Can’t load WP function into external function
- Count the number of times the search form template gets included on a page
- PHP code inside shortcodes
- Limiting woocommerce line_total decimal length
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Run a filter when a walker runs
- How can I use wp_insert_comment to write a comment when a post is edited?
- Using Multiple Submit buttons to trigger customised php functions
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Woocommerce Attributes pulling in wrong data
- Removing unneccessary p-tags (Not every p)
- How to remove the excerpt in the Dzonia Lite theme
- comments_number display outside specified span
- Choose To Display Post Views With An Options Panel
- Prevent Data Resubmission On Page refresh
- Set WordPress Default Template
- How to create a custom category of wordpress admin
- Adding a div at the bottom of a sidebar
- Shortcode content filter?
- How to run JS, PHP and etc. inside WP post?
- add_query_arg not working
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How do I display a user’s previous orders as a select box option on a product?
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- Shortcode button dosent work for all posts. Work for first post only
- allow subscribers to see private posts without plug in
- Replace word in “the_content” only for index.php
- How do you add customer capability after Woocommerce purchase?
- How to get specific image in media library with php
- Function set default image when image not present
- Custom location for attached images
- WooCommerce – Reset quantity input field when variation changes
- Query all posts of a custom taxonomy term
- get current product name in functions.php