How to make Wordpress Custom page - php

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

Related

How to have custom page template in wordpress

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

Must a WP landing page be in HTML or 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!

How To make Google Form plugin appear on Homepage?

I'm using Chameleon Theme from eleganttheme.com for my site project. See at onthegoventuresng.com and I want to display a form below the 3 blurbs content areas on the homepage.
I spoke with the customer support, they said that's beyond the support they can provide for the theme. I was advised to seek a 3rd party help for the theme customization.
Meanwhile, I know it's the theme's homepage file home.php
I installed Google Form plugin with the intent that the form should display below the content areas on the homepage.
Pls how do I go about this any code to insert will be appreciated.
If you know where to add the code in home.php, you can try adding this:
<?php do_shortcode('[wpgform id="xx"]'); ?>
Replace xx with your form id, and make sure you're adding that outside of any other php tags.
This will run the shortcode to display your form through the do_shortcode function: https://developer.wordpress.org/reference/functions/do_shortcode/

PHP: Wordpress Test Page

The problem!
I have a Wordpress site up and running. I wanted to add a custom page, for example if I browse to site.com/mytest it would display just Hello world without any css etc.
What I've tried
I added a mytest.php file under var/www/wp-content/ and tried to browse to it. (The code simply echo a static text).
What I got was simply a 404 page by Wordpress.
To view the file you uploaded, browse: site.com/wp-content/mytest.php
If you just type site.com/mytest , wordpress will thin you are reffering to a page stored in the wp-database. Since it's not you cant view it.
To add the page in the menu, use custom menu and add as "Custom link".
You can make your page a wp custom page template by adding this at the top:
/*
Template Name:Your Page Name
*/
Then create a page in the wordpress dashboard pages and select your page template from the page template dropdown.

Wordpress - creating custom pages with php code

I need to add few additional pages to my wordpress site.
These pages should not be "part of the site", ie they should not be linked somewhere from the posts and so on.
However, they should have the same header/footer as the rest of the site ( I am using custom theme ). And they should be accessible via url.
The final requirement is, I should be able to code in php.
At the moment, I tried to create a new "Page" in my admin console. And then write some php-code inside. However, all my php code gets commented and since not executed.
I don't think that installing plugins such as Exec-PHP is a good idea, so I am trying to find other solutions.
Any comments/advice/suggestions how to make it?
I would be grateful if you give me some how-to link.
Thank you in advance.
You can use a custom page template in your theme for this and just keep the site empty in the admin panel:
http://codex.wordpress.org/Theme_Development#Custom_Page_Templates
By using Template tag's you can create custom page.
write this code on the top of your php file....
/*
Template Name: Your Template Name
*/

Categories