Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
How can I to create a custom page in Wordpress 3.0. Give me any link of tutorial.
WordPress provides a clever way to do this called Custom Page Templates. To create a WordPress Page Template, you’ll need to use your text editor. Go to the directory on your server where you installed WordPress, and then navigate to the directory of your theme. Usually that looks something like this: “/wp-content/themes/default” where “default” is your theme name.
That’s where you will create your custom page template file. Create a file called “cover_page.php” and add the following code to it:
<?php
/*
Template Name: Cover Page
*/
?>
<?php get_header(); ?>
Here's my cover page!
<?php get_footer(); ?>
more details read this
http://www.expand2web.com/blog/custom-page-template-wordpress/
To add to the answers above, one good way is to open a text editor (I like notepad++) and copy and paste the content of the page.php file into a new file, including the php template name code in one of the previous examples.
Call it something unique (like custom_page1.php ) and upload this file via ftp to your active theme folder inside your wordpress install on your server. You can use filezilla for this or another FTP program.
Refresh your editor page in wordpress and you should see your template listed with the others on the right.
Now when you publish a page you can choose this template from the dropdown menu on the side panel.
You can use the Page Template feature of wordpress to create a custom page.
First create page using pages->add new.Then,give title (for e.g. aboutus). Then click
Publish on right side of the window(no content is needed for the custom page).
Then,on left side of window click Appearance->Menus.
In menus window,on left side you will see Pages heading,in that click Most Recent and
check aboutus page. Then it will be shown on right side window.
Then,on left above Pages heading, you will see Custom Links, in that enter # in URL textbox
and aboutus in Label textbox. Then click Add to Menu button.
Done. You will see the menu as custom on right side of the window and then click save menu
button at the bottom right.
Then to check, on left top of the window click the website or your blog name. You will see
the menu. Click on it. No changes will occur.
That's it, done!
Here are some plugins you can use while creating what you need then you can turn them off or remove them.
http://wordpress.org/extend/plugins/theme-file-duplicator/
http://wordpress.org/extend/plugins/theme-file-maker/
Very easy way to do what you need.
This is a very simple part of WordPress theme development, I suggest giving the documentation (the WordPress Codex) a good read before going any further. There are also a tonne of great WordPress tutorial sites out there that will get you heading in the right direction.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I am developing a wordpress website and I would like to have two instances of the website, one in english and the other in german. My goal is to when a user visits my website, the user is redirected to the correct language, based on his/her browser language. But I want to do this with only one instalation of wordpress. I can make duplicates of the pages (one in english and other in german), make a homepage duplicate by setting the homepage as a template for pages. My issue is the menu. How do I set different menus to different pages?
You'll need to register a new navigation menu, and add it to the templates you are using for the German pages, then make a new header template, then set your templates to use that new header. Here's the steps needed to do this:
Register the menu
In your theme's functions.php, you'll need to add some code like this at the end of the file:
function register_german_menu() {
register_nav_menu('german_menu',__( 'German Menu' ));
}
add_action( 'init', 'register_german_menu' );
What this does is tells Wordpress that you want to add a new location for a menu to be customised in the Appearance > Menus page. You should from now be able to add items to your menu, but they won't show up anywhere yet.
Create some page templates
You will have to create a set of page templates for the German half of the site. You will need a new page.php and a new header.php template. I would recommend calling these page-german.php and header-german.php respectively. For your page-german.php, copy paste the page.php template into page-german.php, and add this comment at the top of page-german.php:
<?php /* Template Name: German Page Template */ ?>
This tells WordPress to recognise it as a page template, and tells it it's name. This makes the template selectable on each individual page.
Now, you need to make a header template. Copy paste the header.php template into the header-german.php. In this new template, look for a line that looks something like
wp_nav_menu(array('theme_location'=>'something'))
And change it to:
wp_nav_menu(array('theme_location'=>'german_menu'))
This will display the German menu instead of the regular menu.
Now, go back to page-german.php and look for the line that looks like:
<?php get_header(); ?>
And change it to:
<?php get_header('german'); ?>
This tells Wordpress that on this page, you want to use the header-german.php file to generate the header rather than header.php.
Setting up page templates and Menus
First, go to the Appearance > Menus tab, and create a new menu, then assign that new menu to the slot "German Menu". Then, you will need to go through all the German pages of your site, and in the right sidebar when editing, set the page template to "German Page Template". Now your pages using the new template will display the German menu instead of the English one!
Further?
If you have other templates that need converting, then you can convert them as described above, by making a copy and changing the get_header() call. I didn't really expect this answer to be this long but I hope it helps!
You can use a plugin like WPML to achieve this but if you dont want to use a plugin, you can edit header.php and add a condition on which menu to load depending on the browser language.
e.g.
<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang){
case "en":
//display english menu
break;
case "de":
//display german menu
break;
default:
//default to english or german menu
break;
}
?>
Above code was taken from: Detect Browser Language in PHP
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
What i have
I have a wordpress hosting website.
Wordpress admin information.
FTP details
What i do
I have create html website and upload it in ftp.
What i need to do?
I have to launch my wordpress hosting website using those html pages website uploaded in ftp.
So please tell me how to set theme and configure my wp-admin dashbord so i can use my html pages as website.
EDIT: Question is on Hold. But i get a working solution
Step 1) Open Ftp
Step 2) Delete all files with folder like www public_html
Step 3) make your default page as index.html
Step 4) It will know work as a default website
Step 5) Open Your website in browser now you can see your static html page there
To do that you need to set up your own Wordpress Theme. I suggest using one of the starter themes. I've had the most success with http://underscores.me/
The idea is to modify the underscores theme you just downloaded (which has almost nothing in it) so that, when you open a page in your WP website, it shows nothing at all (not even the title, menus, sidebar, nor the post content). The general guideline is this:
1. Study the .php files in the underscores theme you just downloaded. Try to modify the PHP code so that you end up with files that show nothing when loaded by WordPress but still work without an error. This is mainly your header.php and footer.php file, your page.php file, and post.php. I might be missing some, just check all of them.
2. Embed your HTML code into the PHP files of your theme. What's of interest to you is to embed your header and footer in header.php and footer.php. This will load your header and footer on any of your pages but leave the middle section (your content) blank.
3. Create new pages from the WP Dashboard so that they're loaded dynamically alongside your header and footer (and whatever else you added). When you create a page, just copy your HTML content into the page's content (make sure to tick the "Text" tab and not the "Visual" tab in the WP Editor). Your website will load just like your pure-HTML one did but dynamically and in a WP environment.
Hope that was helpful. I know this is not the cleanest way to do it. But you'll learn in the process.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm entirely new to WordPress but have been tasked with creating a website for my uncles business. I'm trying to understand a bit more about the mechanics of WordPress before I do any more coding so I have a question about index.php / front-page.php.
I had been working on index.php before I even decided to implement WordPress so everything is hard coded. So at the moment I have a fully populated index.php file that I custom designed myself. My understanding of WordPress so far is that everything is dynamic. So I feel like what I should have done is created a front-page.php with a function within it to call the static 'Front page' that I create within the WordPress GUI, then outputting it using the_content();?
Is it okay to have hard-coded in WP, or is this against best practice? Obviously with my current implementation we will not be able to edit the file. How would I go about editing the CSS for this - For example I have a div named 'services' with a background image for this div in the CSS. How would this be implemented from within WP?
Ok i think you got it wrong, wordpress works on themes. In order to make your html design work with wordpress you will first have to create theme. Creating a basic theme is as simple as creating a new folder. Here are some of the basic files that are important, and difference between index.php and front-page.php.
style.css, This file will contain some comments that will define
the details about your theme
Header.php, The header part of your html design goes in this file including the main menu and slider.
Footer.php, the footer part i.e. copyright statements, footer menu etc goes in here
index.php, this file is used by default for list of blogs, but you can change it from settings > reading > and then choose the page you want to show as home page.
front-page.php, this is similar to what index.php does but it has more priority. So if both the files are present then this will be used. Another advantage of front-page.php is that you can add any kind of hardcoded html in here as it is not used by any other page.
page.php, this file is used to show all content of wordpress pages, like about, contact etc.
single.php, this file is responsible for showing a single blog post.
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've created an HTML page as part of my website which I would like to use as a template for news articles. The page has all the things it needs, it just needs to display the correct news article in it.
I installed WordPress on my webserver and now wonder how I can have wordpress publish articles using my HTML page?
Is this even possible since WordPress works with php?
thanks
What you are talking about is themes. Wordpress allows you to create a theme for your installation so it displays using your html/css (more or less)
The way I do this is copy the default theme and make changes in there, and then you can switch to your new theme in your settings.
Edit: in addition, you can also load up wordpress on any page using:
include( '/path_to/wordpress_install/wp-load.php' );
This will allow you to use wordpress functionality on any page of your site.
just edited the single.php file by pasting the desired html code and leaving the loop code there where the text needed to show up.
didn't need to break up the page in a header, body and footer. Left out sidebar for now, but will put it back after I edit it properly.