Create Page with Template File from Plugin Folder

It is probably wp_insert_post can’t recognize your template. You need to include it in the list of the templates. function wpse410645_add_plugin_template( $page_templates ) { $page_templates[plugin_dir_path( __FILE__ ) . ‘/templates/mytemplate.php] = ‘My Template Name’; return $page_templates; } add_filter( ‘theme_page_templates’, ‘wpse410645_add_plugin_template’ );

Custom post type is_singular condtional not working when managing sidebar display

I refactored the if conditional using suggestions from Jacob Peattie and the following fixed my issues. if ( ! is_page_template( array( ‘template-investment.php’, ‘template-tourism.php’ ) ) && ! is_tax( ‘listings’ ) && ! is_singular( ‘listing’ ) ) { The result correctly removed the sidebar.php from loading its code on specific templates, taxonomy, and single post type.

Why isn’t this add_filter function working as expected?

apply_filters( $tag, $value, $param, $otherparam ) This is how the apply_filters function work. By default, the value is printed if no function is hooked with the filter. It’s not clear what directorist_icon( ‘fas fa-chevron-right’, false ) prints here. But if it is showing “next” string at the output, the filter is working right. If you … Read more