Overriding current theme files via plugin

Template logic is primarily controlled by template-loader.php. The part you are interested in would be get_404_template(), which passes on to generic get_query_template() with number of hooks to override the logic and result. {$type}_template (so 404_template) filter would probably do it.

How to format custom fields when editing an attachment?

You’ll have to include and enqueue a new CSS file for your plugin on the admin side using admin_enqueue_scripts. And since you may want to load this on every page, I’d follow the first example on the Codex (pasted here): function load_custom_wp_admin_style() { wp_register_style( ‘custom_wp_admin_css’, get_template_directory_uri() . ‘/admin-style.css’, false, ‘1.0.0’ ); wp_enqueue_style( ‘custom_wp_admin_css’ ); } … Read more

strange shortcode error: does shortcodes requires any dependency?

Problem 1 It doesn’t work because you’re using new_weber but you’re registering news_burner, and they aren’t the same So instead use: [news_burner] You only need a closing shortcode if it’s containing content which that plugin does not. Problem 2 Shortcodes don’t work in text widgets out of the box, you can add that functionality via … Read more

Correct Plugin File Path

https://developer.wordpress.org/reference/functions/plugin_dir_path/ It looks like this function adds a trailing slash, so starting your string with a slash is not required try; require_once(plugin_dir_path( __FILE__ ) . ‘assets/MCAPI.class.php’);

Dynamic assign a custom template to custom post type posts

locate_template search template only in themes then to use a file outside themes, you can use the filter template_include like that add_filter(“template_include”, function ($template) { $post = get_queried_object(); if ( is_single() && (“features” === $post->post_type) ) { // absolute path to the template file $template = __DIR__ . “/../../template/my_features_template.php”; } return $template; });