I hope someone might be able to help me with this.
I have had a new page template built for a wordpress website and have uploaded it to the theme folder. However can someone tell me how to add that page template to the drop down menu in the page editor so it can be selected.
Many Thanks
You'll need to add this snippet to the very top of the file.
<?php
/*
Template Name: Put Your Template Name Here
*/
?>
Ref: http://codex.wordpress.org/Page_Templates#Custom_Page_Template
Related
I developped a theme for Wordpress for one of my client and in that order, I created multiple pages in html for the moment. Except my index (static homepage) using the "single" template I think, I have other pages (each one is different and using different style CSS).
Is it possible, and how should I create and name the custom PHP pages in order to get each page displayed by its own html basis and styling?
Didn't find any matching answer on the internet yet, just general stuff about pages in wordpress, not custom ones.
Thank you a lot by advance if you can help me!
Separate php file for each webpage
Name each php file what ever you like, it does not matter
Add a template name at the very top of each php file
/*
Template Name: Unique Name
The template is for ....
*/
Open the wordpress backend with wp-admin and press create new webpage. When creating the new page select the template name you want.
Done !
It is hard to completely understand the problem. I notice you have .html theme and you want to use this template as page template. In this case you have to create a file in the root of theme with name: cutome1-page.php and this file needs to start with the following line:
<?php /* Template Name: Custome1 Page */ ?>
after that, while you create page in wordpress panel, you see a template as : Custome1 Page
I'm fairly new to Wordpress and using the html5blank theme for the first time. I've built the home page with all the code on the page.php file. I have a host of other pages I need to create which I've started doing on the wp-admin dashboard but what I can't seem to figure out is where I put the code for each page?
Do I create individual text files for each - product.php / about.php etc ? How do all the different paths link up on the site?
I'm sure this is a really straightforward thing for an experienced WP developer. Any help appreciated.
You can create a file called aboutus.php and add this at the top.
<?
/*
Template Name: AboutUs
*/
?>
This wil make the template show up on the page atributes in wp, where you can select it as the template for your page. This is very basic... you can read up on template files here... https://developer.wordpress.org/themes/basics/template-files/
I am new on wordpress and are using the themes as well. May I know where do I put a new file if let say main.php? I want to make a custom main page and replace the index.php page on the theme. Do I need to put it under htdocs\wordpress\wp-content\themes\<theme-name>. I am using this locally on my computer.
On my main.php, I also include css file. Where do I insert the css file as well?
you can set your front page in wordpress dashboard customization options
Go to Administration > Settings > Reading panel.
and select the page listing in dropdown , but before that you have to create a new page and select you custom page from dropdown . see the below image.
refer this for more info
you can have your css file keep on style directory of your theme and link it in your main page using
get_template_directory_uri() . '/styles/your-style-file.css'
You have to create page template for this.
Have a look over below thread hope this will help you
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
i m a newbie to wordpress. I have started theme development and encountered these problems. I think these kind of problem does have a solution, but i m not able to find it out.
I m trying to make a custom page. Uptill now i have made header, footer and main index page.
I see that whenever my theme is activated, I see these default index page, with header and footer assign to it.
I have also made some cutom about us , contact us pages using the Add Pages Functionality of wordpress.
My Problem:
1.Now I m trying to make custom product page where I will have more than 100 images on that pages, and then i can change the images, add the images and description and the link url in future. I have made some html code and put it in the text Tab . I can also see the images on the frontend of the Custom page. But my template breaks. Images goes up and description goes far below.
Also i wanted to add fancybox to all the images which are goin to be replaced or added. But again my template breaks.
So can we make custom.php page and do some coding or anything which you feel is the right way of doing it, Please let me know.
Firstly create product.php page in templates folder using below code on top
<?php
/*
Template Name: My Product Page
*/
get_header();
// write your code here
get_footer();
Then, assign the above template to the page in admin.
Then, that page you can call in menu.
For more detail, check here :- http://codex.wordpress.org/Page_Templates
Actually you don't really need to create a custom template for this unless if you are planing to use that same template on another page.
If your page name is products , just create a file called page-products.php in your theme root. and write your code inside that page.
If your planing to develop themes first be comfirtable with wp template hierarchy.
http://codex.wordpress.org/Template_Hierarchy
I am building a new website and trying to add a new page for news with a custom template. The only problem is that it does not load the template file I set it to load, instead it loads my homepage template. I figured it had something to do with the Template_Hierarchy but it seems i'm unable to find out or change the fact that it loads a wrong template file.
Things i use atm for news
Page: News
Custom post type: News
Taxomony tag: News
Perhaps i should change something because they all use the same names.
The URL where I want the custom template to load is
http://www.website.com/news
I hope someone can help me out with this.
Thanks in advance.
Edit:
I've just noticed that also when I visit any other page that menu button gets highlighted(so you know you are on that page atm.) But when I visit the news page it highlights "Home".
From what you have mentioned, I think you should change the theme file name and check the template settings in Wordpress Backend if you are able to view the template.
For eg
/*
Template Name: News New
*/
Thanks and Regards
Shiva
Create a php file inside your theme folder with the name 'page-news.php'. Copy the same code as your 'page.php' file inside page-news.php. This is the file that will be loaded when you enter http://www.website.be/news. Customize this file as you wish.