Jump to content

Archived

This topic is now archived and is closed to further replies.

John Olsson

How to create a page template?

Recommended Posts

John Olsson+    8
John Olsson

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
John Olsson+    8
John Olsson

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
Rob    547
Rob

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?


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
John Olsson+    8
John Olsson

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
Rob    547
Rob

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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
John Olsson+    8
John Olsson

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
Rob    547
Rob

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


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
John Olsson+    8
John Olsson

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
Rob    547
Rob

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


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
Rob    547
Rob

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


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
John Olsson+    8
John Olsson

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
Rob    547
Rob

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.


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
Rob    547
Rob

Very true!


Former PageLines Moderator, Food Expert and Raconteur

Share this post


Link to post
Share on other sites
John Olsson+    8
John Olsson

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

  • Similar Content

    • Jared Smith
      By Jared Smith+
      I haven't figured out how to get the "Sync Loaded Item" option in templates menu of Platform 5 to stay checked. It doesn't give me an option to save settings when I select it, and when I select it then click off the editor, it unselects. Also if I select it before loading a template, it doesn't stay checked there either.  Whats going on?
    • Queue-it
      By Queue-it+
      Hi,
      I created a Pagelines template for a "Post type" post. Whenever creating a new post page it firstly display that template post and I have to manually change it in the scope from "All of type posts " to "Current page". 
      Is there a way to fix that? 
       
       

    • richardjacruz
      By richardjacruz+
      I'm building a website in a dev environment at http://162.144.182.17/~uescocra.
      I want to import a bunch of products, and then have the products have a different template than the default template. 
      I also want to change the default template for blog posts.
      Before I go making changes, can I do this where the post type of "products" has its own global template, and the same with blog posts?
      For instance, in a product I might want to have a widget for categories, similar products, etc., and in the blog I may want list of the latest posts, blog categories, link to an email sign-up landing page, etc.
      Thanks.
      Rich
    • abuzzelli
      By abuzzelli+
      Is there a shortcode or a way to automatically pull the site name into the footer or elsewhere?
    • seanocaside21
      By seanocaside21+
      An old client of mine has come across an issue with their website. 
      The site is fine on the front end but when you log into the DMS editor the 'About' page template isnt available instead the template for the 'Print Services' page appears
      Here is the live About page http://www.digicom.ie/about/. And see attached file for what i see in the back end.
      In the page settings i can see that the wrong page template is active but I'm not sure how this is the case if the live page is correct. The client assures me they didnt activate the template. 
      Any help at all? 

×