Blog

WordPress Pagination

WordPress comes with its own default pagination with links that appear at the bottom of the blog index page. These links are however limited to only Previous and Next. While these links do help users in navigating the blog content, they do not prove very helpful especially when a visitor wishes to quickly browse through the blog content that is embedded deeper into the blog pages.

WordPress allows this to be overridden with the help of a plugin or hook. You can instead display page numbers which allow users to quickly navigate to any blog page they wish. If you wish to choose the easier way out, then here’s a very neat plugin called WP-PageNavi. All you have to do is install this plugin and then write a single of code within your blog index page. The code should look something like mentioned below.

If you are using ‘the twentyfourteen’ theme then replace the below line of code and you are done -

<?php twentyfourteen_paging_nav();   ?>

with

<?php wp_pagenavi(); ?>

What if you want to show pagination on a page where you are using custom post type? Then you will need the following piece of code instead.

<?php
$paged = get_query_var(‘paged’) ? get_query_var(‘paged’) : 1;
$loop = new WP_Query( array( ‘post_type’ => ‘News’, ‘posts_per_page’ => 3, ‘paged’ => $paged ) );

while ( $loop->have_posts() ) : $loop->the_post();

the_post_thumbnail();
the_title();

endwhile;
?>

<?php wp_pagenavi(array( ‘query’ => $loop)); ?>

See how an array needs to be passed to the wp_pagenavi function. This array should contain the query object that is returned by the WP_Query function in WordPress.

Hope this will prove very useful in customizing your default pagination in WordPress pages.

Secure Your Videos

If you have been faced by a challenge to secure videos on your website then I am sure you must have heard about the “Unlisted videos” feature from YouTube.com and Vimeo.com. However this feature doesn’t actually keep your videos secure. Once a user comes to a page having an unlisted video, he can see the source code of the generated webpage in the browser and grab the video URL. There’s no stopping him from sharing that URL with others. When you make a video unlisted, you are only telling YouTube or Vimeo to keep the video away from search results. However if someone gets access to an unlisted video he can further share that video.

I came across a WordPress specific solution that completely protects your videos from un-authorised access. This solution also saves server space considering you have very large video files. I am talking about Amazon S3. You just need to subscribe to use Amazon’s S3 services. You can upload your videos to S3 using any tool like CloudBerry Explorer or a Firefox plugin called S3Fox.

You then need this very neat WordPress plugin called “s3flowshield”. It’s available here. It’s not free though. See how you can use the plugin in this video. It allows you to specify the a key and secret available from Amazon so that the plugin can connect to your S3 storage. You can then specify the S3 URL of your video and the rest is taken care by this plugin.

When the page containing the video is loaded, you will notice that there is no way for a user to view the source code of the loaded page and grab the video URL. The plugin uses JavaScript code in encrypted form which eventually displays the video on the webpage.

You can also set the plugin so that the video is made available as a downloadable link instead of an embedded video. In this case you can specify that the video URL should not remain active for more than a certain number of seconds. That way the video link will no longer remain active after the above time limit is reached.

I hope you’ll like this solution.

Does it really help to get your website listed in DMOZ?

Well, apparently no. At least that’s what Matt Cutts from Google says in this video here. All that matters is high quality links back to your website. However, it doesn’t hurt to have a link back link to your website from DMOZ. Google appreciates back links from DMOZ as well. Another important thing why Google likes DMOZ is when a page is really popular and if it is blocked by robots.txt. In such cases Google relies on DMOZ snippets to capture the information about that web page.

As long as you manage to get back links to your website from any reputable websites you are good for Google.

How to migrate from Joomla/Virtuemart to WordPress/WooCommerce

We recently were asked by a client to migrate a website from Joomla to WordPress. The new website would have a new design but all the data or page content would remain the same as per the old website. The challenge we faced was migrating the data from Joomla over to WordPress.

There is a WordPress plug-in available which does exactly we wanted. It’s called FG Joomla to WordPress. This plug-in can migrate sections, categories, posts, images, medias and tags from Joomla to WordPress. This plug-in worked like a charm for us. We were able to migrate all the Joomla pages as WordPress pages.

However, there was one more challenge for us. The Joomla website had Virtuemart installed which was used to sell books online. This was a real challenge for us because we couldn’t find any good plug-in which would do this for us. So we decided to migrate the data ourselves.

Firstly we installed WooCommerce, an eCommerce plug-in for WordPress. We then wrote SQL queries to first migrate the Joomla product categories over to WooCommerce. To migrate the products we had to again write SQL queries. Lastly we migrated all the product images using a very good script as seen here.

Migrating Virtuemart products and categories over to WooCommerce requires thorough understanding of how WooCommerce creates products and categories in the WordPress database. It uses the same WordPress tables like wp_posts, wp_postmeta, wp_terms, wp_term_taxonomy and wp_term_relationships. These set of tables are just sufficient to migrate categories and products from Virtuemart.

If you have a similar requirement then please get in touch with us. We’ll be glad to help you.

Custom Post Types in WordPress

Custom Post Type in WordPress is special post type that you can define yourself. A normal post in WordPress is what appears under the Blog entries. It can be added from the WP admin panel interface. A normal WP post is generally text content along with some uploaded images.

With custom post type you can add more to the default WP functionality of posts. Here’s an example. Consider you want to showcase your projects under the Portfolio section of your website. You would want to display more information apart from just the text content. With custom post type it is possible to have a separate menu called Portfolio in the admin panel. It is possible to define various new fields in the add/edit screen which you want to display on the Portfolio page of your website. For example, you can define a dedicated field to capture the project start and end dates, a field for the project URL, a field for the client name and any other field you like.

The above example can be extended to virtually anything you like. You can have custom post types for Events, Team, Services, News, Music CDs, Artists, etc.

Find out more about implementing custom post types from the WordPress official site.

If you like the easy way out then here’s a very good WP plug-in called More Types. You may also like to check out another plug-in called More Fields which can be used to add new fields to your custom post type. These fields can range from text-field, textarea, checkbox, radio button, WYSIWYG or select box.

Responsive or Dedicated Mobile Theme for Magento

Should Magento have a dedicated theme specially targeted for mobile phones and tablets, or should it have one single responsive theme that works in desktop browsers as well?

In Magento one can set up multiple themes. One of these themes can be specified in the admin panel that should be picked up by Magento if a user is accessing the store from a mobile or tablet device. Of course this theme has to be a slim down version of the original website theme so that it loads faster on mobiles and tablets. Magento admin interface allows this to be done from System > Configuration > Configuration Scope > Design. Here’s a good article on how to do this.

This approach has a downside that a new separate theme has to be created specifically for mobiles and tablets.

However, what if one single theme was sufficient enough to display your online store on all platforms. I am referring to responsive design which adapts itself to the screen resolution the user is using to view the website. You can read more about responsive designs here.

This approach has its own downside that the website may / may-not load with the same speed on mobiles and tablets which have limited connectivity.

Ultimately the the choice is with the client and/or the designers. Personally I feel that Magento should have a slim down version of theme for mobiles and tablets so that page load speed can be optimized for devices running on low speed connection.

 

Cloud Computing: What’s in it for me?

Today everyone who logs on to Facebook or similar social networking sites, uses Cloud Computing. What is it and what does it mean to a normal user? Well in simple terms it is a cluster of server farms where all your data is mirrored. So whenever a request goes out from your browser to fetch an image on Facebook, it is routed through to one of these servers. These servers could are spread across the globe or within a single country itself.

From business point of view cloud computing has many benefits. That’s why many companies are already switching over to cloud computing. They have started hosting their web applications in cloud. Some of these benefits are:

  • Whether it’s CPU power or storage, pay only for what you use.
  • Easy access to more storage as required. This helps in scalability.
  • Auto Updates for software and hardware relieves IT team from future upgrade worries.
  • High availability of your data in case of any disaster.

There are many companies that offer cloud computing services. Some of these are Amazon, Google, Salesforce, Rackspace, HPDell and Microsoft.