How to use custom footer template in a site-plugin?

You cannot override header / footer templates from a plugin, you’ll have to change the theme. theme_page_templates can be used to change the general template for the post type page. That template then uses get_header() and get_footer(), which in turn include header.php / footer.php (optionally header-$name.php, if a parameter has been passed to get_header(), same … Read more

How to exclude posts by ID within a category/archive loop

Use pre_get_posts to exclude the categories you don’t want to display in the loop. function exclude_posts_from_specific_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-2’ ); } } add_action( ‘pre_get_posts’, ‘exclude_posts_from_specific_category’ ); Or create a new WP_Query and use the Category Parameters. $args = array( ‘category__not_in’ => 2 , ‘category__in’ => … Read more

How can I load Template file from wordpress plugin

You can check below code : change Page slug “gym-dashboard” as per your requirement. <?php function rt_include_gym_dashboard_page_template( $template ) { if ( is_page( ‘gym-dashboard’ ) ) { return plugin_dir_path( __FILE__ ) . ‘templates/content-gym-dashboard.php’; } return $template; } add_filter( ‘template_include’, ‘rt_include_gym_dashboard_page_template’, 99 );