Must a WP landing page be in HTML or PHP? - php

I've been asked to create a landing page for a client's WP site. I don't have much experience with WP and wondering if the page should be an HTML or PHP file? I have a CSS and JS file too. Any advice would greatly be appreciated.

Take a look at the WordPress Codex on how to make custom themes. You could edit an existing theme although this isn't advised as you'll lose your changes when you update it.
The landing page must be saved as a PHP file. WordPress will automatically include the right file depending on the page that is requested. The most straightforward way to do this is create a file called template-landing-page.php and on the very first line of the file, paste this in:
<?php /* Template Name: Landing Page */ ?>
Then add your landing page content into that file. When you're done, go to the dashboard and edit/create a new page. Look for the Page Attributes meta box on the right hand side and select the Landing Page template. Save the page.
Then you have a new landing page!

Related

Dynamic body in html for making wordpress theme

Can you help me, please ? Maybe this question is stupid but I am new in Wordpress. First I have created project using html and css, javascript. Then, I have converted my html code to wordpress theme. For example I have written get_header() instead of html head and get_footer() instead of html footer. Finally I must do dynamic my project's body but I can't. For example when i change page, header and footer must stay in its place but body must changing. Problem is I do not know to write code in my body section. my code's seem
I have called my other section though get_template_part().
I have tried to write my html code in adding wordpress page, to be more clear, in wordpress dashboard. When I change page, body's seem must changing.
What should i do, please ?
In your templates add the HTML of particular pages like the home page and other cms pages and in the admin dashboard go to the Pages section in the page template and assign the particular page template for example you have created a home page template for the main page go to pages in admin dashboard in page template assign the home page to the page then you can see the HTML of the page on frontend.

How to make Wordpress Custom 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

Add PHP Pages to wordpress

I have a HTML form that user can interact with and insert the data to a database.
( One HTML form and about 3 pages .php )
I need to implement this form to a word press page.
I created a page in wordpress and it gives me a blank area to write my content but i don't know where i put my files.
so appreciate your support to help me , thanks .
Where you place your files depends greatly on the structure of your wordpress template. If you want to make a page that can be accessed via a url like "www.yourdomain.com/form", then you can make a "Page" in Wordpress (via the "Page" panel via the dashboard), and name it "Form" and then, in your form's HTML (or PHP) file, set your HTML up as a template using this syntax:
Put this at the very top of your PHP page that contains your form's HTML/PHP:
<?php
/*
Template Name: My Form Page
*/
The code comment above is something wordpress will look for exclusively, and tells the wordpress engine that this page (your form HTML) is now a template named 'My Form Page'. So now, in the Wordpress Page editor for your "Form" page, you can attach your new template to your newly-created "Form" page by selecting "My Form Page" from the Template Dropdown in the Page editor.
Here is a screenshot of what the "Template Dropdown" looks like (per the Wordpress documentation):
After you follow these steps, navigating to this page will reveal your form's HTML, instead of a blank page.
You should refer to the Wordpress documentation on Page Templates for more information:
Hope this helps!
There are a few ways to add custom behaviour to a WordPress installation. Either per Addon/Plugin or Template Logic or custom modifications. I would recommend that you read through the wordpress developer guidelines and write your php files as plugin.
After that hook your plugin to your desired destinations and do your whished actions.
See this link for writing your plugin: wordpress codex

How do I edit an individual page in WordPress

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.

header.php not including in custom page wordpress

Please make me correct where is the problem and what should i do,
i am trying to make my custom page template in wordpress. Also the default landing page,
What i did is, just created a file jp_home.php and set the Template Name: name here.
And then create a page with the name home and select the theme for the home page, second i went on the settings>reading> and select the a static page and select my home page as a landing page.
All these changes i have done in themes/twentyeleven/ template.
NOW the problem: in jp_home.php
<?php
/**
* Template Name: WebTech Eleven
*/
//get_header('new');
?>
<!-- Wrapper Start -->
<div id="wrapper">
Here is my Page
</div>
<!-- End Wrapper -->
<?php
get_footer();
//require("footer_old.php");
?>
after commenting the get_header() i am still viewing my header.php i don't know why?? and the rest part not visible. Can anyone please explain what wrong i have done??
?>
Well if you still see the content from the header and none of the changes/additions in your jp_home.php then WordPress isn't pulling up that template file.
It sounds like you're doing everything you need to but lets just review how to accomplish what you're looking for.
Ensure that you have jp_home.php in the twentyeleven theme directory. With that in place, go ahead and create your Home page. Select WebTech Eleven under the Template option and save the page. After that, go to your Settings > Reading and make sure that your Front Page is set to display a static page, and set that to Home.
Make sure you are then actually navigating to the correct home page and you'll see the new template in action (a good way to do this is to navigate to edit your Home page and click "View Page"). I just tested all of this locally and it works for me.
Very clear and concise tutorial here also: http://wsmithdesign.wordpress.com/2011/01/19/creating-a-custom-wordpress-home-page-template/
Go to Pages -> All Pages and open the page you want to use the template on (THAT static page in your case). On the edit page, did you choose "WebTech Eleven" under templates?
Also, I must ask. Have you tried clearing cache on client side, and server side if you're using any cache there?

Categories