Categories
WordPress

Creating an AJAX Powered Pagination in WordPress

Pagination on blogs is quite in common. But an AJAX powered pagination on a cool themed blog is the apple of my eye. In this tutorial we are going to see how to change your old styled pagination into an AJAX powered dynamic pagination.

In this tutorial I assume that you have basic knowlege of editing HTML, PHP and Javascript. I have used jQuery for handling ajax and the modified code for pagination from Lester Chan’s WP-Page Navi

The tutorial will consists of creating a basic pagination using PHP, jQuery and editing some template pages. Make sure you backup your ooriginal theme before trying this.If you arent able to follow the tutorial download the zip file at the containing the required files. (including css style).

Step 1

Firstly, open up the index.php and/or home.php if it exists. Wrap the div that holds all the posts with a div of id #ajaxcontent. And add <?php pagenavi(); ?> just before the end of the content div.
Will look something like this

<div id="ajaxcontent">
<div id="content">
<?php if (have_posts()):
while (have_posts()):
the_post(); ?>
.......
.
.
.
.
<?php 
endwhile;
endif; ?>
<?php pagenavi(); ?>
</div><!-- end #content --></div>
<!-- end #ajaxcontent -->

Step 2

Create a new folder called plugins in your current template’s directory. Download the zip package containing all the files. Copy the pagenavi.php and pagenavi.css file into the plugins folder in your current template’s directory.

Step 3

Now just copy everything inside the #ajaxcontent wrapper(Make sure you dont include the ajaxcontent wrapper div too.) and create a new file called wp-ajax-post.php in your root directory and paste it there.

Step 4

Add this code on top of wp-ajax-post.php

<?php
require ('wp-blog-header.php'); query_posts('paged=' . $_GET['p']); $paged = $_GET['p'];
?>

Step 5

The last thing to do is, open functions.php in your template directory and include the pagenavi.php plugin like this

 <?php include("plugins/pagenavi.php"); ?> 

So that was the tutorial, check out the working example/demo on the home page of my blog Small Business and Technology Blog

Download Ajax Pagination Files

Related posts:

  1. How to Backup and Synchronize your WordPress Blog
  2. Including Files in PHP – Learn PHP in 7 Days – Day #6
  3. How to Create a WordPress Plugin – Hello World!
  4. Its time to Upgrade your WordPress Again – How to Upgrade from WordPress 2.6.2 to WordPress 2.6.3
  5. WordPress: Creating Custom 404 Pages
Categories
WordPress

How to Backup and Synchronize your WordPress Blog

This tutorial is based on the assumption that you already know the basics of WordPress and FTP. If you need any kind of help with the tutorial, fell free to as me a question below in the comments
wp-backup-cds2I don’t trust web hosts. Yes I mean it I don’t trust any web hosts. I am not saying that web hosts aren’t reliable but when it comes for backup, I don’t trust any web host. No Godaddy, no media temple, no hostgator. First of all I don’t like hosting at godaddy and hostgator either. They have are far too many clients than they can tackle. The best host that I feel to host a wordpress blog is Wpwebhost and I have all my websites and wordpress blogs hosted there. They are the best hosting service for a budget price that I have found so far.

When it comes to backup, thought my host provides me regular backup like most of the pout there, but I still backup my blogs on my own and sync them up to date. I feel this very convenient to keep all my blogs synchronized on my local computer. It makes me feel secure to have everything updated on my local PC. So basically I keep my local backup by, synching my blogs after every 2-3 posts. The main reason for doing this is I don’t have to download those large big backup files generated by the server.

Things to have in your Inventory

Before starting up, these are the things that you may require

Firefox 3.0 – Yeah you need this if you don’t have

FireFTP – So you have firefox like everyone does huh! Grab this extension that we need to synchronize all the image files

WP-DB-Backup – This plugin will help you get the fresh copy of your updated wordpress database

Lets get started – How to backup the Database

We’ll start off with the downloading the database as this is a one step method, next we’ll move on to synchronizing files. Activate the downloaded plugin. Click on DB backups in the sidebar under the posts.

wp-sync-tutorial-1

You get to see something like this, Select all the tables that you want to add in the database and click on backup button

wp-sync-tutorial-2

You will now get a link to your backup file. The backup is created somewhere in wp-contents folder. Simply download that file. You now have the backup of your database.

wp-sync-tutorial-3

The next big thing – How to backup and sync files

This is what is somewhat lengthy process but easier though.Let us first create a new folder where we will be saving/synchronizing the blog. Now keep ot ready and open the Firebug Extension from the Tools menu in your browser. Connect to your website using FTP and navigate to the /wp-contents/uploads/ folder of your blog. Do the same with the local folders, I mean to say navigate to the /wp-content/uploads/ folder in your local sync directory.

wp-sync-tutorial-5

Click on the image to enlarge it

Now click on the Tools button and click sync directories and subdirectories menu.

wp-sync-tutorial-6

You will see some FTP activity going on in hte log and then you may see a dialog box like this.

wp-sync-tutorial-7

Click on the Download button and then click on the Sync button. You will see some files get downloaded and that’s it, you get both the directory synched up to date.

This is what I do with all my blogs. Got a better idea? Please write below…

Related posts:

  1. Tweet My Post: Tweet and Twitter your blog posts
  2. Its time to Upgrade your WordPress Again – How to Upgrade from WordPress 2.6.2 to WordPress 2.6.3
  3. How to Upgrade to WordPress 2.6.5 Easily
  4. Free WordPress Theme – WpTechTuts v1.0
  5. How to Create a WordPress Plugin – Hello World!
Categories
WordPress

How to Create a WordPress Plugin – Hello World!

A wordpress plugin can do wonderful things with your blog. Developing a wordpress plugin may look more difficult compared to themes but if you know PHP then thanks to the hooks and functions, developing a wordpress plugin is very simple.

This is a very simple and basic tutorial in which we will create a simple plugin that prints Hello World! on your blog.

Let us begin with creating a new folder inside the wp-content/plugins/ directory. I will name is as hello-world.

Create a new php file inside the folder we just created. I am naming this file as hello-world.php. Now Before we get started with the plugin, let us first add the meta data to the plugin. Open the hello-world.php and add some information on top, something like this

<?php
/*
Plugin Name: Hello World
Plugin URI: http://www.yourdomain.ca
Description: A simple Hello Word Plugin
Version: 1
Author: John Doe
Author URI: http://www.yourdomain.ca
*/

That was our meta data. Meta data is pulled out by the wordpress core and is displayed in the plugins page of your wordpress admin. Now we will create a simple php function to print Hello World! Add this code below to create a simple hello world function

function helloworld() {
        echo ("Hello World!");
}
?>

Save the file. The above code will output Hello World! when the function is called from any of your pages. Go to the Manage Plugins page (wp-admin/plugins.php) and activate the Hello World Plugin.

Now we need to call the function from some file to execute it. Open the index.php (or any file like footer.php) file in your current theme folder and add this anywhere where you would like to see the code. (preferably at the end near the footer).

<?php
if(function_exists(’helloworld’)) {
helloworld();
}
?>

Save the file and reload your blogs main page. You mush be seeing Hello World! somewhere where you have put the code. This example might not be interesting but it is a good start to learn coding plugins.

Make sure you are subscribed to feeds, as more tutorials will be coming soon.

Related posts:

  1. WordPress Plugin – RSS Post Editor
  2. How to make your WordPress Theme Widget Ready
  3. How to Create Post Accordions in WordPress
  4. WordPress Plugin – Techytube
  5. 3 Most Important SEO Plugins for your WordPress Blog
Categories
WordPress

Its time to Upgrade your WordPress Again – How to Upgrade from WordPress 2.6.2 to WordPress 2.6.3

As my opened my blog’s dashboard today, the first thing that I noticed was please upgrade your wordpress package.

Well I knew WordPress 2.7 was to be released in November. But never expected 2.6.3 to be out. And this may be the last time I am upgrading wordpress as WordPress 2.7 is to be incorporated with an auto upgrade feature. Cool !

So coming back to 2.6.3, the upgrade 2.6.3 was necessary as recently there was a critical vulnerability announced in the Snoopy Library. And our wordpress uses the same to get feeds in the dashboard. This is a simple upgrade and I wont recommend you to download the complete 1.2 MB package and upload it to your server and go throught the upgrade process if you are already running WordPress 2.6.2. Basically only 2 files needs to be replaced here in case of upgrade from WordPress 2.6.2 to.Wordpress 2.6.3 which are

  1. wp-includes/class-snoopy.php
  2. wp-includes/version.php

Download the zip file which contains both the upgraded file.

Unzip it

(If you dont have any compression utility your Windows XP already supports zip files. You can view a tutorial on using zip files here)

Upload both the files  to your wp-includes directory.

Make sure the files are overwritten… Happy blogging and our special thanks to Rockorn.com for the 2 files

Related posts:

  1. How to Create Post Accordions in WordPress
  2. How to keep your PC clean and junk free with CCleaner
  3. WordPress Plugin – Thumbs Me Up!
  4. MS DOS Tutorials – How to Create, Append and View Files and Move Files and Directory
  5. How to create Ebooks and PDF Files using Google Docs
Categories
WordPress

WordPress Plugin – Thumbs Me Up!

Hey there everyone, We are excited to release your first WordPress plugin – Thumbs Me Up! Please check out below

Description

This plugin adds a small thumbs me up appeal (in a block-quote) with a StumbleUpon Thumbs up button to all your visitors that come to your site from StumbleUpon. Visitors from other websites are not shown this button. You can see it working here http://www.stumbleupon.com/url/www.mygeekpal.com/windows-xp/over-10-windows-shortcuts-that-you-probably-dont-know.html, Make sure you visit the website from a stumbleupon page.

Current Version : Alpha RC 1

Checked on Version : 2.6

Click here to Download

Demo / Screenshot

If you have come to our website from Stumbleupon.com you might have already seen it working. Other ways I have provided you a screenshot of how it works, below….

Related posts:

  1. Over 10+ Keyboard Shortcuts for Windows XP (Some You Probably Might Not Know)
  2. [Video] How To Uninstall Applications in Windows XP
  3. [Video] How to Determine A Computer’s Configuration in Windows XP