last day (15 days later) » 

12:36 PM
1
A: Wordpress: How can I create a page template out of an existing page?

suspectusYes, you can create a template and apply your template to your pages. With the content that you wish to apply to your pages, create a .php file. At the top of this.php (called say page-mycontent.php) file add this header: <?php /* Template Name: My Template */ ?> Now the template will ap...

 
Where can I find the specific php file of my page?
 
Where is the shared content? e.g In the loop, the header?
 
The content is in the header and in the loop
 
ok, then it sounds as if two new templates are created, one for the header and one for the body (the loop). Is there any way to identify the 4000 pages, an author or a category for example? I mean If a page has a certain category, then apply your templates.
 
Yeah all pages have different names and in the content are short codes to make the pages look a little different from each other.
 
12:36 PM
And the short codes are in which template? page.php?
 
they are in the page, which I want to create a template of
 
is there any way to group the 4000 pages? This is so you don't have to trawl through a 4000 page editing exercise :)
 
Yeah man I know haha. If you go to the Pages in Wordpress you can select all pages and bulk edit them (change the template)
 
I've edited answer with more info - hope it helps.
 
yeah sounds good thanks, but how can I export my layout as php code 'caus I create it with advanced layout builder and I can find a way to show the source code.
 
12:36 PM
the code you've create goes into your theme directory, or better still the child theme directory (if there is one).
 
yeah I know where to place it. But how do I export my page (which I want to use as a template) as php code, because I used an layout builder, which don't show you the php code
 
Can you save your page?
If you can save it as HTML you just need to add a '<?php' tag at the top of the file.
From layout builder can you see HTML at least?
 
Okay now I got it, but if I change the template of one page and try to view it it says, that the page is broke
 
Take a look at debug.log to see what is going on. I don't think my answer is of much use to you.
 
Okay I fixed it. We are so close to solve it thank you so much. It almost work perfect, but the shortcode doesn´t work for some reason
 
12:36 PM
ok great, is the shortcode one you have created? Has the shortcode been added in functions.php?
 
I am using a plugin called shortcoder for this. But if I call the short code in the template with the function: <?php echo do_shortcode("[shortcode]"); ?> It makes the side broke
 
I guessing that you just need [sc name=”your-shortcode”] (no php tags)
 
I tried it, but it didn't work
 
Any indication in the logs?
 
okay first of all thank you so much for your help
nah it just put it out in normal text
 
12:46 PM
I think shortcoder will only work in post or page content, not in templates. Is your shortcode large? Can you try just pasting in the code into your template ? Or a simplified version.
I mean just take the shortcode code (or a simplified version) and paste in your new template. This is php code, right?
 
I mean yeah its possible, but there are a lot of shortcodes
 
Well, just try a simple shortcode for now
 
yeah i tried that and it worked, but most of them are large
 
I suggest contacting the shortcoder plugin author to see if there is a way to use shortcoder code in a template file.
 
do you know a different shortcode plugin, where it is working with template
I go it
 
1:04 PM
I'm afraid not, I don't use such plugins. But thinking about it, there should be a way to use the shortcodes, even "shortcoder" ones. The plugin must store them somewhere within your system. Find them, and get the WordPress name for the shortcode, Then all you need to do is add some code to register the shortcodes in functions.php. Not difficult.
 
stupist error in the book. I used differen quotion marks I had to use this -> '
but instead I used -> ""
Thank you so much for your time
 
ok! glad you have got somewhere with it
 

last day (15 days later) »