WordPress how to add another page? - php

I am using the newest version of WordPress (version 2.8.4)
I'm wondering how I would add an additional page.
I have a navigation that looks something like this.
home | about us | contact us | ... etc.
I read somewhere to go to pages -> add new but it forces me to put the content within WordPress rather than edit a PHP file itself.
How would I be able to enter PHP in it? Is there something else I can do?

For example if you want to add home, "About us" pages:
You have to create template pages for this.
For this you need 3 files: header.php, index.php and footer.php.
If you are using an existing theme, you will find these three files in your theme folder itself.
For creating your home page, copy the following into your index.php file:
<?php get_header(); ?>
<body>
/* include whatever u want in ur body tag */
<?php get_footer(); ?>
index.php will be automatically assigned to home page.
For the "about us" page, create a file named aboutus.php (whatever name you want with .php
extension) and copy and paste this code.
<?php
/**
* Template Name: aboutus //don't forget to add this name according to ur page name
*
* Selectable from a dropdown menu on the edit page screen.
*/
?>
<?php get_header(); ?>
<body>
/* whatever u want in ur body tag */
<?php get_footer(); ?>
Then go to dashboard of your website or blog, there click pages->Add new,
give the Title as Home. Then click publish button on right side of the (Add new page) window.
Then, on left side of the screen, again click pages->add new, then enter title as "about us"
and then, in right side of this window, you will see a dropdown box named template, click the dropdown and select "about us" from it. Then click publish button.
Now we are going to create menus to appear in the website or blog. For this,
On left side of window,click Appearence->Menus.
On left side down of window you will see Pages heading, in that click Most
Recent, check home, aboutus pages and click Add to Menu button.
Then, the selected pages are displayed on right side and click Save Menu button on right corner.
Then, on left top corner, click your website or blog name to view your website with the two menus with their pages.

Create a Template in your theme folder, then set the page to use that.
If you want to do it without creating a Template, you may be able to use a plugin such as Exec-PHP, however this brings with it a bunch of possible security issues.

Why do you want a content page outside of Wordpress and outside of the WP loop? You still need to use a template and WP includes or you'll run into permalink problems.
You can make a WP page but exclude it from navigation, if that's what you're after, with something like Exclude Pages.

I'm a bit confused about what you're asking, but if what you're looking for is a way to have a link in your WordPress navigation that goes to a page you create outside of WordPress, you can use this plugin:
http://wordpress.org/extend/plugins/page-links-to/
If this and the other answers aren't any help, you might want to edit your question to clarify what you're trying to do with the php.
Good luck!

Related

Wordpress - how to add general content area to a specific “page” that's not actually a page?

I purchased a WP theme https://themeforest.net/item/pressville-municipal-wordpress-theme/19949423 and need to add general content area to the People page: https://preview.themeforest.net/item/pressville-municipal-wordpress-theme/full_screen_preview/19949423?_ga=2.67243158.624148492.1570058772-1881232054.1569979687
The People page is actually a section in the WP dashboard (kind of like Media or Portfolio section) so technically not a editable page in the WP backend. I contacted the theme creator and was told that it's customization (not included w/theme) and advised to hard code text into the php. The problem with that is it's not accessible to other users who have no design or code background.. Is there a way to create a page with editable content block for this People section so it's easily editable without knowing code?
Also, the “People” header text changes if you click on subcategories (to “Elected Officials”) for example. When you click a subcategory, the main menu (People page) no longer shows as active which can be confusing to users. Is there a way to fix this so header stays consistent (like Contact page header) and menu item shows active regardless of what subcategory(All, Elected Officials, etc) is selected on the People page? Thanks.
You can create a regular page called "People's page" and add text to it. Then if you want to show that page's content into a PHP template you can do the following:
Step 1. Create the Function
Open up your theme’s functions.php file and paste the following code, likely at the bottom of the page.
function cn_include_content($pid) {
$thepageinquestion = get_post($pid);
$content = $thepageinquestion->post_content;
$content = apply_filters('the_content', $content);
echo $content;
}
Step 2. Use the Function in a Template File
Next, open up the specific template file you want to include the Page’s content on and paste in the function:
<?php cn_include_content(31); ?>
Replace 31 with the ID of the Page you want to include. How to find a page ID.
Is sounds like you need to go to your wp-admin and click appearance/ menus. Here you can remove these menu items that might be default but have no pages associated with them. You can then add the pages you want and come back and create a custom menu. Hope that answers the first part of your question.

can not find content folder in prestrashop

I am new in prestrashop. I am working on http://www.how2brich.com
website. There is about menu. I have putted content of this menu through admin but i want to change some data inside the code.
the link is showing http://how2brich.com/content/4-about-us this.
I am not content folder and 4-about-us page for change code.
Any one plz help where to get about-us page content.
To change content of this page go to Preferences >> CMS and if you want to change the code go to "/themes/yourthemename/cms.tpl" but keep in mind it will change all CMS pages code so add a condition(like if , else) to add specific code for this page.
To get content editor "about-us" page please enter Back-Office. Then Preferences->CMS. And then please click on button "edit" on the "about-us" line.
If you need to change the code (template) of the cms pages please find the template on the path "themes/your_theme/cms.tpl"

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.

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

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