Load different template file when condition met?

Can you perform the logic on the template_include filter? Else, you could set a global/constant and use that in template_include to serve up the appropriate template. The template_include filter filers the path to the template file to be included. To avoid errors you should check if the template exists – locate_template does this for theme/child-theme … Read more

Hide page visual editor if template is selected – redux

The following works for me, testing with TwentyTwelve. Using load-{$pagenow} instead of admin_init avoids the checking for the global $pagenow. See comments for further info: // Run only when editing a page // For new pages load-page-new.php should be used // See: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/admin.php#L217 add_action( ‘load-page.php’, ‘hide_editor_wpse_88886’ ); function hide_editor_wpse_88886() { // Not really necessary, but … Read more

Gutenberg Editor – Template Doesn’t Match Error

This is a known issue. A hack would be to disable to the validation completely for the block. Chris Van Patten provided the following code example: /** * WordPress dependencies */ import { compose } from ‘@wordpress/compose’; import { withDispatch } from ‘@wordpress/data’; import { InnerBlocks } from ‘@wordpress/editor’; /** * Container block * * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)