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/
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 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 don't want to edit the template files - I'd like to make a new template file. I'm looking in the MySQL registry, but all I see is a table for posts, not pages. Someone mentioned the editor earlier, but that doesn't help with creating new templates.
I think I create a php file in my content>theme>my_theme directory, but I'm not certain.
Thanks for any help.
This should help you out:
It shows you which pages map to which template, and how new templates should be created. As an example, if you created an About Us page (singular, static page with the default page template), here's what Wordpress checks for:
Is there a file called page-about-us.php?
No? Is there a page called page-#.php (where # is the pageid)
No? Just render the generic page.php
In your case, if you want to edit a single page (it's a page right, not post?) .. then simply creating a file called page-$slug.php would be sufficient .. WP will use that "template" when rendering that page.
If it's still a bit unclear, check out the source link here (it makes things crystal clear!): http://make.wordpress.org/docs/theme-developer-handbook/part-one-theme-basics/template-hierarchy/
You can create your own template files in your theme directory, or a subfolder. Use a comment on top that has the name of the template.
/*
Template Name: Custom Template
*/
You can assign the template to a page under the "Page Attributes" box in the dashboard.
Of course you need more than just that comment to display anything in your template. You might stay by copying the content of your theme's index.php, then edit from there.
[NEW AT WORDPRESS]
I'm creating my own wordpress theme with own css etc etc. I've managed to get everything good in the index.php file, and I'm trying to make the other pages as well now.
When I make the home.php, blog.php, about.php and contact.php file (in my theme folder) they don't link to it. I'm following the "WordPress 3: Creating and Editing Custom Themes with Chris Coyier" on Lynda.com and the example shows that whenever you make a file with the same name as your page, it takes that directly (which works at his tutorial).
Anyone that could know what is going on?
Example:
I got a file blog.php in my theme folder, and when I go to www.mydomain.com/blog the loaded file is the index.php file, instead of the blog.php file
There are two ways you can get this working using custom page templates.
Create a template for one specific page using the page slug or ID. In this case, change the name of the php files like this to match the name of the page you created in the UI: page-home.php, page-blog.php, page-about.php and page-contact.php
Much more flexible is to create a custom template that can be used on ANY page. Just add the template name to the top of the php file like so (inside the php block):
/*
Template Name: My Home Page Template
*/
Then edit the pages and select your custom template from the template dropdown menu (on the right hand side I think, if its visible).
Reference this page for more info: https://developer.wordpress.org/themes/template-files-section/page-template-files/
Found the solution to my (silly) problem.
Creating a page in your theme directory & adding the template comment at the top of your php file isn't enough. You need to go to the admin panel->pages->YOUR PAGE-> and check out the page attributes. There you can link the page to a certain template: http://d.pr/i/a0m0
I have a page in HTML(index.html), and a folders named images, css, js that used in it.
Now i have to do this in WordPress. Is there any plug in to convert Html to WordPress or any other way to do this in WordPress? Please help me.. i'm a beginner in WordPress.
I am not sure of a direct way to implement a HTML page into a WordPress theme, but if you have made header and footer files for your website, then all you need to do is convert them to make them WordPress compatible.
You should refer to the codex.
You can also go for any of the WordPress frameworks listed here.
A WordPress theme is easy to understand if you know basic PHP. It has a set of files like
header.php // header file
footer.php // footer file
index.php // the index file
page.php // for your WP pages
single.php // for your WP posts
and some other files
Go through the codex and it shouldn't take long to get the hang of it.
You need http://themematcher.com/
It'll automatically take your site, styles, images etc and create a wordpress theme for you. Check it out
Search for HTML to WordPress theme conversion and you can find so many good tutorials.
Check this article:
http://thethemefoundry.com/blog/html-wordpress/
Theres really only three ways:
Hire a freelancer
Convert manually by referring to http://codex.wordpress.org/
Use an automated converter. Best one on the market is
https://htmltowordpress.io
here is the link for complete solution of this problem.
http://wordpress.org/support/topic/how-to-integrate-htmlphp-page-to-wordpres?replies=6
make sure to add
/*
Template Name: Custom Page Template
*/
piece of code in index.php page at top in your selected theme folder, not on ur main index.php file.