wpexplorer / page-templater Goto Github PK
View Code? Open in Web Editor NEWDynamically create WordPress Page Templates with PHP
Home Page: http://www.wpexplorer.com/wordpress-page-templates-plugin/
Dynamically create WordPress Page Templates with PHP
Home Page: http://www.wpexplorer.com/wordpress-page-templates-plugin/
I am opening this issue for reference in a future PR and to enable discussions around it.
For more flexibility, allowing developers to use templates in paths not relative to the class file, the plugin could allow filtering of the file path.
Does anyone have any idea what it is that WP has changed to make this no longer work?
The page templates no longer appear in the page template selector of the page editor, after updating WP to v4.7.1
The actual pages created before updating Wordpress, and their customisations that use the templates do still remain, so it is still functional but, the templates no longer appear in the template selector, which makes creating new pages with the custom templates impossible.
Any ideas? I haven't been able to figure it out yet.
Cheers.
https://make.wordpress.org/core/2016/11/03/post-type-templates-in-4-7/
How do we add support for post type template?
use filter theme_{$post_type}_template
in the class.
I'm using this code in one of my plugins and works perfectly with the current version of WordPress.
Unfortunately it will no longer work with the upcomig v4.7 due to the changes they have made to accommodate post type templates.
I'm trying to figure it out but so far I'm just tearing my hair out!
How would I get this to work on the index page? I've tred calling my template file home.php , page.php and front-page.php
Have an issue on activation on line 10
Fatal error: Cannot redeclare class PageTemplater in C:\xampp\htdocs\playground\wordpress\wp-content\plugins\page-templater-master\pagetemplater.php on line 10
How to fix this?
Thanks!
Hi.
I'm using WP 4.9.2, and am developing a plugin using the Wordpress Plugin Boilerplate. Because the Boilerplate handles all add_action
statements with a helper function, I found I had to not use an array to pass the class and method. Instead of add_action( 'plugins_loaded', array( 'PageTemplater', 'get_instance' ) );
I am using: $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'PageTemplater::get_instance' );
But, I'm getting an error about class hierarchy: ( ! ) Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Home_Search_Admin' is not a subclass of 'PageTemplater' in /var/www/html/wp-includes/class-wp-hook.php on line 286
add_action
cause something to be handled differently that how I've done things?add_action
need to be placed in the plugin code (i.e., really really early)?I have already had several template in my wp theme
when i use this plugin,the template in my theme can not display anymore
my english is poor ,can u understand what i want to express
waiting for your help thanks
How to make it work with Custom Post Types?
Nico Amarilla on autoloading in a plugin container provided a great method framework for building plugins. I've adapted it for multiple plugin fields and now for the PageTemplater. The constructor now looks like this:
public function __construct(array $templates)
{
$this->templates = $templates;
...
}
and my plugin includes this:
$prefix = __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Templates' . DIRECTORY_SEPARATOR;
$templates = [
$prefix . 'member-content.php' => 'Restricted Member Content',
];
$templater = new Rma\PageTemplater($templates);
add_action('plugins_loaded', array('Rma\PageTemplater', 'get_instance'));
Edit:
The template is listed in the dropdown yet not applied. When the page is updated its template is reset to Default Template. The path is correct.
Not sure what's changed yet, but I see that 4.7 breaks the templates I had injected with page-templater into a plugin.
Hey everybody,
I created new composer package from this class with some additional features:
I hope this will be useful for somebody.
If the page using custom page template through page-tempaltar comes in the search page results, the page template takes over search page template and everything is broken
Any idea why?
Hi! I'm picking up where another dev left off on a project and noticed he used this plugin/code. Curiously, every time I run a deployment of new code the template is dropped from the page in question and I have to go select it again. Any idea what might be going on with that? Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.