Create Custom Wordpress Page Templates

Category : Wordpress

Sometimes, you may not want all of our Wordpress pages to look exactly the same. You can easily create multiple page templates so that you can diversify the look of your Wordpress blog so your whole blog does not look exactly the same. Here’s how:

Using your FTP program, browse to your theme’s folder. This would be located at:

Wordpress Home Folder > wp-content > themes > theme name

Now that you are in your theme’s folder, most themes will name their page template “page.php”. Download that file to your computer, and then open it using a plain text editor such as Notepad or Notepad++. On the second line, add the name you would like to assign to your new Wordpress page template. Each page template has to have a unique name. It is important that you enter the page name exactly like this:

< ?php
/*
Template Name: Test Page
*/

You would replace “Test Page” with whatever unique name you want to assign to your new page template. You can create as many page templates as you want.

Now, save and close the file. The next step is to rename the file. Again, each file should be named something different. For example, you could have page.php, page-test.php, page-third.php, etc. Once you’ve renamed the file, upload it to your theme’s folder.
Continue Reading

Popularity: 6% [?]

Exclude Pages From Search Results

Category : Wordpress

Many Wordpress bloggers want to exclude pages from their search results and only search through posts.

True, there are plugins available that will help you accomplish this, but I always try to avoid installing slow, bulky plugins when I don’t have to. Using this method, you only need to add 1 line of code to your search.php file.

Search Only Posts

To exclude all pages from your search results and only search posts, open up your search.php file located in your theme’s directory.

Towards the top of the page, you will see:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

Just below that line, add the following:

<?php if (is_type_page()) continue; ?>

So now, it will look like this:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if (is_type_page()) continue; ?>

Using a simple PHP if statement, we only search through posts.

The last step is to open the file wp-includes/functions.php and scroll down to the very bottom just before you see:

?>

and enter the following:

//Search only pages
function is_type_page() {
global $post;
if ($post->post_type == ‘page’) {
return true;
} else {
return false;
}}

That’s all there is to it! Now any searches performed on your blog will show only post results and exclude all the pages!

Popularity: 39% [?]

How To Move Wordpress To A New Server Or Host

Category : How To, Wordpress

I have seen many requests online on how to move a Wordpress blog to a new server or host- including requests from some of my readers.

Move your Wordpress blogIt seems as though the easy part is transferring the files. What most people find difficulty with is moving their Wordpress database to the new server or hosting company.

While there are other tutorials available online, many seem to lack clear instructions on how to move your blog. In this tutorial, I’m going to take you step-by-step and show you exactly how to move your Wordpress blog to a new server or host.

It may look difficult at first with all the steps I’ve included, but I assure you- it’s easier than it looks- especially after you move a blog a few times. It may seem like there are many steps to moving your Wordpress blog to a new server, but there really aren’t that many. I’ve just broken each step down to make it very clear even to beginners exactly how to move their Wordpress blog.

So, are you ready? Here we go:

Open either your FTP program or your file manager through your hosting company and browse to your home or public_html directory. With Wordpress installed, it should look something like this:

How To Move A Wordpress Blog To A New Server Or Host

You want to download all the files and folders to a convenient location on your computer, then upload all the files and folders to your new server/host.

Once you have all the files on your new server/host, you need to download a copy of your original Wordpress database from your original host.

(All of the following screenshots were taken from cPanel, but if your host uses a different administration panel, the steps will be the same- they may just look slightly different.)

Once logged in to your administration panel, go to phpMyAdmin.

How To Move A Wordpress Blog To A New Server Or Host

Once you click phpMyAdmin, in the left column click on the database that is used for your original Wordpress blog.

Continue Reading

Popularity: 100% [?]