• 0
Sign in to follow this  
Followers 0

How to create a page template?


Question

Posted · Report post

I've tried to search for it but couldn't find it.. How do I create a simple page template inside my dms child-theme?

 

Let's call in for example: template-custum.php

 

..Or is it possible?

Share this post


Link to post
Share on other sites

16 answers to this question

  • 0

Posted · Report post

Tnx, but.. hm, but i'll want to create a page template, a single page template from the backend, where I can for example build an advanced php-code or other..?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Hello John,

 

A template in DMS is built on the front end, not the back end. I'm unclear what you mean about PHP, but DMS is largely dynamic and doesn't use old-fashioned theme type PHP pages.

 

Were you intending to add some PHP code snippet into a template?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

No, i'll understand that.. :) I looove DMS..

 

For example.. I want to use the dynamics of DMS and WP, and on top of this, i'll want to create a sort of.. don't know really how to explain it easely, but it's about photos, and uploading photos, som db-connections as well, outside the WP-db.. Theres gonna be quite advanced code, big ones..

 

Let's say i'll create a single page in wp/dms.. it's called "photos", i'll simple wanna input my own code in the template part, and load the header and footer as usual..

 

In the front-end:

 

(Header)

 

(Template) - For example, i'll just want to include "custum.php" here..

 

(Footer)

 

Does it make sense? :)

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

If it's a PHP script, there's a much simpler way of doing this than what you're describing.

 

Get this plugin:  http://wordpress.org/plugins/shortcode-exec-php/  and activate it.  Read the docs on that link.

 

Add your custom PHP code to that plugin, leaving out any HTML (no body, html, or head tags).  The plugin will help you create a shortcode. Copy the shortcode.

 

Make a template in DMS with no sidebars.  Add a single column section. 

 

Add a Textbox to the single column section.

 

In the Textbox, paste the shortcode.

 

Publish the page.

 

Save the template with a new, unique name and description.  Publish again.

 

Use that template on any pages you want to apply it to, and your script will work on it.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I'll try that. Let me get back for a... review... or so.. :) Tnx Rob!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

You're very welcome John.  Let us know how it goes.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Well, it worked fine really, however, I weren't able to include a file that was in my child-theme-folder, or any else, except for inside the Shortcode Exec PHP-plugin-folder, and that's just not the best i recon.. :) Any ideas about that?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

John,  are you copying your custom php file into the Shortcode Exec PHP folder?  

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Please tell me, step-by-step, what you did to create the shortcode?  Thanks.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Well, it did work just to include a file, for example custum.php that i located in the same plugin-folder, but when I put the custum.php in my child-theme-folder, where it supposed to be when i'm working on it, the it just says it couldn't find the file, even that the path was correct..

 

U understand? :)

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

John,

 

The way Shortcode Exec PHP works is you copy the PHP code from the custum.php file and paste it into the Shortcode Exec PHP screen.  See this: http://wordpress.org/plugins/shortcode-exec-php/screenshots/

 

Where it shows you hello_world between square brackets, you're creating the shortcode name.  Where it shows you return 'Hello World'; that's where you would paste your PHP code. Not an include instruction, but the actual PHP code you have inside custum.php. 

 

Shortcode Exec PHP will write the PHP code into the WP database, allowing the shortcode to pull the PHP code from the database when you apply it to a page.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

A lot of tutorials are in internet

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Very true!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

OFC i know how the shortcodes work.. :)

 

But my ? is still, the easiest way to "INCLUDE" a php-page.. The code is going go be really complex and it isn't a good workflow if i'll have to copy paste in into the plugin..

 

There must be a easy way, i can't be alone to think that's a good workflow?

 

Wouldn't it be good if there was a "section" in dms where u simple "include" php-files, that would make it.. perfect.. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0