Affichage des articles dont le libellé est HowTo. Afficher tous les articles
Affichage des articles dont le libellé est HowTo. Afficher tous les articles

samedi 12 novembre 2016

WordPress How-To: The Basics Of WP Plugins Development



alt="WordPress How-To: The Basics Of WP Plugins Development" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/06/wordpress-500x133_c.jpg" />

We will be working on a series of articles focus on “title="WordPress Guides" href="http://www.webhostingsecretrevealed.net/category/blog/wordpress-blog/">how to do X with WordPress“. These articles will be a little lengthy and they are mainly for experienced webmasters and developers; in case you are new to WordPress, please check out my title="WordPress beginner guides" href="http://www.webhostingsecretrevealed.net/blog/blogging-tips/the-complete-guide-to-your-first-wordpress-site/">Guide To Your First WordPress Blog.

And now, some basic introduction.

Expanding on WordPress Features By Developing a New Plugin

class="border" alt="WordPress Homepage" src="http://www.webhostingsecretrevealed.net/images/2012/0410-7.jpg" width="750" />

WordPress is the most popular content management platform in the world, with more than 60 million users of its self-hosted PHP installation package and millions more using its web-based, remotely-hosted WordPress.com service. This is not a coincidence or mistake. WordPress is, quite simply, the most fully-featured, affordable (it’s free!), easily-usable content management application in the world. However, even this titan of content management isn’t absolutely perfect, and many users eventually find that the software lacks one or two essential functions that they simply cannot live without.

Enter href="http://wordpress.org/extend/plugins/" target="_blank">WordPress plugins.

These unsatisfied users will then go on a quest, a large search, in an effort to find the right plugin to get the job done. Some people find that needed plugin, BUT many others simply don’t find that they’re looking for.

Some WordPress users might be content to simply give up the fight and resign themselves to a life where one essential feature is missing from their website. But a sizable group of these users is simply not willing to throw in the towel, and they’ll pursue the process of designing their own custom-made plugin to get the job done. It might sound complicated and intimidating, and some parts of it might be. Certainly, href="http://php.net/manual/en/intro-whatis.php" target="_blank">solid knowledge of PHhref="http://php.net/manual/en/intro-whatis.php" target="_blank">P will be required for more advanced plugins that add real features to the WordPress functionality. But a plugin is a relatively easy thing to write, especially for basic functions that are standard throughout WordPress and simply need to be “reworked” in order to do the job better and present it in a more pleasing way.

Users who won’t settle for second-best, and are thinking about creating their own plugin, need only follow the simple steps below to put their WordPress installation on a path toward greater functionality and compatibility with their big ideas and grand plans for Internet domination.

Step 1: Create a New File within the Plugin Directory and Give it a Purpose

class="border" alt="WP Plugins" src="http://www.webhostingsecretrevealed.net/images/2012/0410-5.jpg" width="750" />

The first step to creating a plugin is to simply create a new PHP plugin file within the existing WordPress plugins directory.

By now, most users should know where to locate that directory as they’ve likely uploaded a handful of plugins to enhance their WordPress installations’ functionality already. However, for those who are really approaching this process as a complete and total novice, the directory containing all pug in files is found at the following location for every version and iteration of the WordPress software:

/public_html/wp-content/plugins/

Navigate to that directory and create a new (blank, at this point) file named “my-custom-plugin.php.” This is the file which will contain all o our work from start to finish, and we’ll give it an obvious name sot hat it doesn’t accidentally get deleted or prematurely activated during the development process. Once this file has been created and uploaded to the server, use an FTP client to directly edit this file (using a built-in text editor) while it is still hosted on the server. This is the best way to edit remote files, as it makes saving and uploading essentially automatic, and definitely easier than managing multiple versions of the same file stored in different locations.

The plugin will now be named, described, and given a “byline.” This is the same type of information that is placed at the top of a theme’s “style.css” stylesheet file, and theme developers will feel right at home by filling out the information below. Place this information into the top of the plugin file before any other code. Even the opening PHP tag should not be placed before these commented lines. If these lines are placed incorrectly, or are omitted entirely, the plugin itself will not appear within the WordPress Dashboard. That means it cannot be activated, used, tested, or debugged, and that’s no good. Here’s what needs to be filled out before opening the file and proceeding to define a function:

/*
Plugin Name: A Custom Plugin Used to Learn the Ways of WordPress
Plugin URI: http://www.your-website-here.com
Description: This plugin is being used to demonstrate how PHP code, WordPress variables, XHTML, CSS, and other information, is placed into a standard plugin PHP file to add new functionality to a standard WordPress installation.
Author: Your Name Here
Version: 1.0
Author URI: http://www.your-website-here.com
*/

With that information having been completely filled in, the plugin will now be spotted by the WordPress Dashboard and its information will be properly displayed alongside other plugins within the plugin activation / deletion administration panel. The plugin has now been given a filename, a friendly name, and a purpose. All it’s missing at this point are some functions. That’s where step two comes in.

class="border" alt="WP Plugins" src="http://www.webhostingsecretrevealed.net/images/2012/0410-6.jpg" width="750" />

Step 2: Defining a Plugin Function (or Functions) for Use on a WordPress Website

This plugin demonstration will assume that the developer has created a href="http://codex.wordpress.org/Custom_Fields" target="_blank">custom field. This field will be used to determine whether or not social media links are included with the post so that users might share the post with their friends and family members who are subscribed to their social networking updates on sites like Twitter, Facebook, LinkedIn, and MySpace. A custom field has been created, in this case, named “social_links.”

Using the PHP code in the plugin, we will determine whether or not the social networking field has data inside of it. If it does, a “bar” of social media sharing links will be displayed. If it does not have any data within it, then these links will be omitted. This is a great way to disable the sharing of posts on your website which are simply not meant for viewing by the wider public, and doing it in a plugin is a great way to ensure that this functionality applies across all themes, rather than simply in one theme’s entry template.

This process is accomplished by “adding” an action to the WordPress code. This is done using the “add_action” PHP command, parked with several “echo” statements and existing lens of WordPress code that can be ported in directly from existing WordPress template files. Remember that virtually any variable which can be used in a template is also valid for inclusion within a plugin file, although the opening and closing PHP tags must be omitted as the code is already wrapped within one, all-enompassing opening and closing PHP tag enclosure.

Here’s what the added “action” looks like within the plugin file when it is completely filled out:

function social_links($post_ID){
global $wp_query;
$ID = $wp_query->post->ID;
if (get_post_meta(13); == 1)
{
return $post_ID . “Social Networking Link Buttons”;
}
else
{
return $post_ID . “”;
}
}
add_action(‘the_content’, ‘social_links’);

The first lines of code are simply used to determine whether or not any “meta” information has been filled out in the WordPress Dashboard for the specific entry being viewed. This is done by querying the WordPress database (using the $wp_query variable) and looking for information within meta field number 13. Each custom field is given a numerical identification, just like entries, comments, and pages. This number can be used within variables for conditional statements.

So, first the plugin looks into the custom field for each entry and sees whether or not content is present in the field’s database table. Next, it runs through the conditional. If the content equals “1,” it proceeds. The usage of “1” in this case means “if the field has data present.” The inverse of this would be “0” which would translate to “if the field has no data present.” So, if the field has data present, or equals “1,” the function proceeds to the first part of the conditional. That section provides for the display of social media sharing links. For the purpose of brevity, those links have not been included with the function. However, they can be pretend using simple XHTML within the quotes that follow the “return $post_ID” statement.

If the custom field does not have data present, it effectively equals “0” as far as this plugin’s code is concerned. However, because this conditional is an either / or statement, instead of one with many different outcomes, we simply use the “else” construction to instruct the plugin to print the alternative content under any other circumstances. In this case, it simply prints nothing. For this reason, all that needs to be placed within the function is:

return $post_ID “”

At the bottom of the statement, we add our new function as an “action” to the existing “the_content” PHP variable. This will append the social network sharing buttons to the bottom of an entry directly after the entry’s content is finished printing. The statements in this parenthetical statement are chronological, meaning the new action (“social_links”) could be placed before “the_content” if those buttons were supposed to be displayed at the beginning of the content, directly after the entry’s title has been printed onto the screen.

With the function completed, and the action added to the WordPress Loop directly after the entry’s main body of content is printed on tot he page, the plugin is essentially complete. This is the appropriate time to add the closing PHP tag, save the file, and upload it to the server for use.

Step 3: Activate the Plugin and Try it Out

The most important part of the process is activating the plugin and verifying that its functions work as expected and do not cause issues with any existing plugins or standard WordPress features. This is also a good time to verify the integrity of the PHP code and ensure that any output (XHTML or otherwise) prints as desired.

If any errors do arise during the activation and testing process, it’s important to check the plugin file and make sure that all statements are properly opened and closed. This means checking for punctuation, in many cases, including parentheses, semicolons, brackets, and lowercase letters. Remember that PHP is case sensitive, and it’s also punctuation-sensitive: Any unclosed statement essentially continues infinitely and can cause pages to simply not load, or load extremely slowly.

When all of the kinks have been worked out, the job is largely complete. However, there are a few additional considerations to keep in mind for other scenarios.

Step 4: Creating a Plugin ReadMe File

class="border" alt="Create A WordPress Plugin" src="http://www.webhostingsecretrevealed.net/images/2012/0410-8.jpg" width="750" />

If the plugin is intended for private use only, there is simply no reason to create a “ReadMe” file unless, of course, you’re afraid that you might forget what the plugin does, how it was built, or how it functions within the WordPress Loop itself. However, many developers create plugins with the intent to distribute them to the wider WordPress community and, with more than 60 million users, this is a lucrative way of promoting a website and earning secondary income.

Those users are virtually required to craft a ReadMe document that outlines the plugin’s functions, how to install the file to the server, and how to set it up and customize its functions. This file can also contain information such as change log which details every change and update made to the plugin over time. However, the important thing is to explain what the plugin does, how it works, and how to install it. Novice users won’t know what to do if they’re not guided through the process, much like novice plugin developers didn’t know how to create a new WordPress function until the last step of this guide.

When the plugin file has been completed and paired with a ReadMe file (typically a .txt file), it’s time to put both documents into their own folder and compress them using the standard ZIP file format. The plugin can then be uploaded to the WordPress Extend community of plugins and themes, as well as to the developer’s server for a self-hosted solution.

Relatively Easy to Do, Especially with WordPress Variables and Functions

The great thing about developing a new plugin for WordPress is that the file can use any existing PHP function, variable, or loop, which WordPress has already defined and initialized. This makes it easy to extend WordPress features and enhance their functionality across many themes, and it makes the plugin development process as easy as creating a new theme for the software itself.

Always remember to test for bugs, validation errors, and function conflicts before putting the plugin into active use or sharing with the wider WordPress community. When that process has been completed, and the plugin is working properly, the development stage is complete and you’ll be free to enjoy the success and new features you just created. ;)

Further readings on WHSR

To dig deeper on this, check out title="Must Have WP Plugins" href="http://www.webhostingsecretrevealed.net/blog/blogging-tips/20-must-see-wordpress-plugins/">Jerry’s List Of 20 Essential WordPress Plugins, href="http://www.webhostingsecretrevealed.net/blog/web-design/25-handy-code-snippets-for-wordpress-developers/">25 Handy Code Snippets For WordPress Developers, title="WordPress Tips" href="http://www.webhostingsecretrevealed.net/blog/blogging-tips/25-most-wanted-wordpress-tips-tricks-and-hacks/">Most Wanted WordPress Hacks, Tips, And Tricks; and, if you are looking for a good WordPress hosting, check out what I’ve been using recently – title="WP engine Hosting REview" href="http://www.webhostingsecretrevealed.net/hosting-review/wp-engine/">WP Engine – it’s quite an expensive host (thus not recommended to newbies) but you get what you pay for.


Page 24 – Web Hosting Secret Revealed




WordPress How-To: Install Multiple WP Blogs With One Single Database



alt="WordPress How-To: Install Multiple WP Blogs With One Single Database" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/01/web-server-data-500x202_c.jpg" />

As an open source content management system, WordPress often finds itself installed on href="http://www.webhostingsecretrevealed.net/hosting-review/ipage/">lower-cost, href="http://www.webhostingsecretrevealed.net/hosting-review/webhostinghub/">budget hosting plans which permit clients to have limited number MySQL or PostgreSQL database per account. This is no problem for those users who plan to only host just one or two WordPress blog, but can be a significant road block for those WordPress users who aspire to host their friends, family members, or a thriving community of independent bloggers.

Luckily, WordPress offers a number of ways to permit multiple installations of the software within just one database, saving users both a significant usability headache and the higher cost that comes from seeking a hosting plan which supports multiple MySQL databases.

The road to enabling multiple installations in a single WordPress database involves extensive editing to the software’s site-wide configuration file for many users. WordPress supports hosting multiple blogs with one installation of the software, or installing multiple instances of the software into one database. Those who choose to do this will need to be familiar with the configuration PHP file, their .htaccess file, and other server settings which are determined remotely by their current web host. Those who are comfortable knowing and modifying these settings are urged to complete this process, as it will likely be simple and take just a few minutes from start to finish.

Step 1: Locating and Changing Settings in the WP-Config.php System File

class="border" alt="Locating and Modifying WP Config" src="http://www.webhostingsecretrevealed.net/images/2012/0418-1.jpg" width="750" />

Every WordPress installation relies on “wp-config.php” to control database usernames, passwords, and locations, as well as settings relating to actual software features and user information. This file is rarely modified, except for in the first steps of a typical installation, and many WordPress developers and novice users may not be sure where to locate the file or which edits to make. For clarification, this configuration file lies in the root directory of every WordPress installation. This will typically be the “public_html” folder for a primary installation, and the base of a subfolder for each subsequent install of the WordPress software.

Once the file is located, it can be edited using an FTP client’s built in file and text editor. Doing this process directly on the server ensures that all edits are made to the remote file and saved directly, eliminating potential data loss and confusion between different versions of the configuration file. When the file is opened, there are a few settings that need to be changed when installing the WordPress software multiple times using the same database.

We will need to href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">configure our “wp-config.php” file in order to customize our WordPress installation. First and foremost, the actual database information must be entered. If this is the first (and primary) installation, the database name, username, and password can be both defined and discovered using the server’s control panel. Both the cPanel and Plesk Panel software have a specific database configuration area that displays this information to users upon request. Fill in all information accurately, as failure to connect to the database will result in a failed installation overall.

Step 2: Changing the Structure of the WordPress Database

class="border" alt="Customizing WP Database" src="http://www.webhostingsecretrevealed.net/images/2012/0418-2.jpg" width="750" />

Every WordPress download comes with a default configuration file which designates a “wp_” prefix to the entire installation. This prefix will be added on to every table which is created by the installer and is designed to separate the WordPress tables from other applications residing in the same database. Similarly, this prefix can be changed in order to separate different WordPress installations from each other. Changing the database prefix is perhaps the most central step to ensuring that WordPress installations can function alongside each other in the same database without overwriting each others’ data, granting the wrong user permissions, or publishing the wrong content.

What to look for in wp-config.php?

In the still-open “wp-config.php” configuration file for the WordPress installation in question, locate the line which determines the database prefix which will be used. It almost always looks like the following example:

$table_prefix = ‘wp_’;

As can be seen, the WordPress developers have loaded the file with the default “wp_” prefix. This can be used for the first or primary WordPress blog installed to a server, but it cannot be used for any secondary installation. Using the same database for multiple blogs will lead to data loss, erroneous content, and all kinds of user permission problems that could enable malicious activity between blogs.

Change this prefix to almost anything else, so long as it is all lowercase and contains no spaces or punctuation marks. The “_” underscore character is not a requirement, as periods or hyphens can also be used. However, be aware that the underscore character is considered the standard way of separating a prefix from a table name, and it’s the easiest to use when scanning database records for certain iterations or cells.

Step 3: Proceed with Installation

If all you wish to do is simply install multiple WordPress blogs into separate databases with entirely separate groups of users and administrators, the process is largely complete. With the correct database information placed into the file, and the proper table prefix in place of the default WordPress-generated option, everything will likely go off without a hitch. However, advanced users might be interested to know that installing multiple WordPress blogs into the same database enables a unique kind of data sharing. Because user tables are all placed into the same database, WordPress can actually be instructed to use the same set of users between multiple blogs; this can be done on a per-installation basis, as well, so only the right users are given access to multiple points of entry and content publication.

For those advanced users who wish to create a site-wide user list that can publish content across multiple blogs, this edit is relatively straightforward to make and must be done at the beginning of the installation process before the actual installation page has been loaded. It’s easy to do, and the process is presented in the next step for those who are so inclined to give it a go.

Step 4: Sharing Users and User Meta Information Among Multiple Same-Database Installations

id="right">

An important consideration to be made when installing many WordPress iterations into just one database is whether or not the users of each website will need to login to a different website within the same domain name’s purview. This can be especially true for href="http://wphacks.com/best-magazine-style-wordpress-themes/" target="_blank">“magazine-style” sites which categorize their content into subfolders and subdomains, with each content creation department having their own WordPress installation and content creation portal. Having a different user account for all users on every blog can be time-consuming and it’s largely an outdated practice.

The “wp-config.php” file can be amended to instruct a WordPress installation to place all data within its prefixed tables, but to pull user information from a differently-prefixed table. This means the primary blog’s user list could potentially because the user list of all blogs installed into subfolders across a website. Here’s how it’s done.

define(‘CUSTOM_USER_TABLE’, $table_prefix.’global_users’);
define(‘CUSTOM_USER_META_TABLE’, $table_prefix.’global_usermeta’);

These two lines must be added to the “wp-config.php” file before the WordPress software is installed. Notice that the tables utilized for user information are prefixed with “global.” This allows both the primary installation and all secondary installations to access the same, universal tables full of user information. It gives no specific WordPress installation control over the user databases, as each WordPress installation remotely accesses that information via the “global” tables.

The two lines of code above could be modified to be named otherwise, including using the standard “wp_users” and “wp_usermeta” tables for those blogs which will simply access information already determined by the site’s primary WordPress installation. Developers should modify these lines intelligently and at their own risk, and remember to do so before installation as it’s exceedingly complex to change the user tables after an install has been completed.

Installing Side-by-Side WordPress Installations is Largely an Outdated Practice

While WordPress will likely never drop support for custom MySQL table prefixes and multiple installations of the software in the same database, the company’s developers have been hard at work on creating a solution which can perform all of the above tasks on an automated, on-the-fly basis. This means being able to create multiple WordPress blogs by using the standard WordPress Dashboard interface, largely eschewing the “wp-congif.php” file edits and database trickery that is used to share user information among separate installations. WordPress provides a showcase of many blogs which use this feature in its href="http://wordpress.org/showcase/flavor/wordpress-ms/" target="_blank">MultiSite Showcase as a demonstration of just how functional, open-ended, and easy a Network is to create and maintain.

The feature is included in href="http://wordpress.org/news/2010/06/thelonious/" target="_blank">WordPress 3.0 and higher, and it’s known as “WordPress Networks.” The company had previously developed the feature as an entirely separate version of WordPress, known as “WordPress MU,” but made the decision to integrate the two during the release of its most recent software version. The feature, while fully functional and quite robust, is not enabled by default. Users will still need to work a little PHP magic within the site’s configuration file in order to be able to access these new and innovative features.

Instead of modifying the database prefix set out in the “wp-congfig.php” file, users will instead bypass that setting and define an entirely new line of code. This line of code instructs the WordPress Dashboard to enable the multisite, or WordPress Networks, configuration options and setup tools. The line to be pasted into the configuration file is this one:

define(‘WP_ALLOW_MULTISITE’, true);

It’s pretty simple, and saving the file will immediately allow the WordPress Dashboard to show the setup and configuration panel within its interface. That’s exact where the user should head next, as the Dashboard is the central feature of WordPress Networks setup.

Once in the Dashboard, click the “Administration” heading in the sidebar and then click “Tools.” Beneath this, a new option named “Network Setup” will appear, and it should be clicked. WordPress will determine whether new blogs should be installed as subfolders or subdomains, and it will ask for a defined directory where it should place blog media uploads (pictures, movies, audio files, and more). With those settings defined, it will get to work and define new database tables, cells, and users. The process may take a few moments.

After the initial configuration has been completed, the site administrator will be presented with a page that instructs them to configure their “wp-config.php” and “.htaccess” files further. These changes will initialize the media upload directory, make essential changes to the way permalinks work for multiple WordPress installations, and enable more of the special WordPress Networks features that set this type of installation apart from standard WordPress versions.

The best part about using this feature is probably the minimal impact it has on the site’s database. Rather than burdening the database with a long list of tables and cells, it installs most of the new information into an existing database structure that doesn’t need to be modified at all. The few extra tables and cells it does install are minimal and efficient, meaning site load times will not suffer as a result of the installation. That cannot be said for databases which play host to many side-by-side WordPress installations which are installed the “old-fashioned way.”

A Note of Caution: Always Be Careful with the MySQL Database

For the most part, there are very few risks associated with installing WordPress to a database in multiple instances. But, as with any change to the site’s database, always have a backup on hand and be ready to restore your data with it. Modifying the database and placing tables side-by-side has been known to occasionally cause incidental data loss which can only be recovered with a backup. Furthermore, accidents do occur and people have been known to forget the essential step of modifying the database prefix. This results in a complete loss of pages, posts, and users.

With the right precautions in place, and careful attention to detail, it is entirely possible to run multiple WordPress blogs from within the same database. Both the old method, as well as the new WordPress Networks feature, can create advanced blog setups that enable robust levels of content, shared user access, and easier usage of the site’s resources than many competing content management solutions would allow for.

Follow Up Reading

This post is part of my WordPress How-To Series. You might also want to check out other popular post on this topic: title="Most Wanted WordPress Code Snippets" href="http://www.webhostingsecretrevealed.net/blog/web-design/25-handy-code-snippets-for-wordpress-developers/">25 Handy Code Snippets For WordPress Developers as well as title="Must Learn WordPress Tricks And Hacks" href="http://www.webhostingsecretrevealed.net/blog/blogging-tips/25-most-wanted-wordpress-tips-tricks-and-hacks/">Most Wanted WordPress Hacks, Tips, And Tricks.


Page 24 – Web Hosting Secret Revealed




WordPress How-To: Create A Showcase for WP Themes Demos



alt="WordPress How-To: Create A Showcase for WP Themes Demos" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/06/wordpress-500x133_c.jpg" />

WordPress theme development has really taken off in recent years, as the WordPress software has reached more than 60 million users around the world. The company has also unveiled its href="http://www.wordpress.com">WordPress.com remotely-hosted blogging solution, on par with services like href="http://www.blogger.com" target="_blank">Blogger and href="http://www.tumblr.com" target="_blank">Tumblr, further increasing the demand for themes and the potential revenue that can be generated by developing these extensive PHP templates. Many authors are familiar with the software’s practice of requiring a small thumbnail image of the theme in action to display to prospective theme users. They’re able to see a snapshot of what the theme will look like when put into practice on their website, and that’s good enough for a large number of WordPress users and developers.

Creating a Showcase for WP Themes Using Live and Functional Demos

class="border" alt="WordPress Demo Theme" src="http://www.webhostingsecretrevealed.net/images/2012/0525-3.jpg" width="750" />
* Screen captured from title="http://www.elegantthemes.com/" href="http://www.webhostingsecretrevealed.net/go/elegant" target="_blank">Elegant Themes – A topnotch WordPress Themes Club I’ve been using for years.

But there are more demanding users and WordPress theme developers out there, and a simple thumbnail screenshot image will not suffice when it comes to demonstrating a theme’s subtle details and intended effect. The dissatisfaction with these small theme images has led a large number of theme developers to launch full-website preview of their work. These previews are actual WordPress blogs which are using the fully-developed WordPress theme on a site that can be fully navigated and experienced by the theme downloader prior to their use of the theme on their own website, or prior to their purchase of the theme for their own purposes. It’s not only more attractive and informative than typical thumbnail screenshots, but it’s also a far more effective way to market and sell themes in this growing market.

Creating this kind of site is considered to be overly complex, however, and many people are simply unsure how to turn a simple WordPress website into a gallery of self-designed themes. Using built-in WordPress features, and some which are enabled via third-party plugins, creating a theme demo site is not only the smart thing to do for business, it’s also the easiest way show users all of the skills and talents a developer is working with.

Here’s how it’s done.

Step 1: Get Those WordPress Themes Online for Viewing

class="border" alt="WordPress Demo Theme" src="http://www.webhostingsecretrevealed.net/images/2012/0525-1.jpg" width="750" />

In order to make this approach work, every theme a developer wishes to demonstrate to potential users or customers must be placed into the standard WordPress themes directory (/public_html/wp-content/themes/). Make sure all theme images are uploaded and the theme folders are all lower-case without any spaces or punctuation, as this will be essential in deploying and previewing these themes across multiple WordPress sites using one of the more advanced built-in features offered in WordPress 3.0 and higher.

When the themes have been completely uploaded, it’s time to back out of the themes directory to the standard WordPress root folder, which is most likely the “public_html” directory.

Step 2: Enabling WordPress Multisite for Theme Presentation

class="border" alt="WordPress Demo Theme" src="http://www.webhostingsecretrevealed.net/images/2012/0525-2.jpg" width="750" />

The easiest way to enable a theme demonstration site is to use the existing WordPress multi site feature, now branded as href="http://wordpress.org/extend/plugins/networks-for-wordpress/" target="_blank">WordPress Networks. This procedure involves using a single database to create a near-infinite number of WordPress blogs that can each be filled with unique content and styled using a completely different theme per blog. This essentially creates an entire WordPress demonstration site, full of entries, archives, pages, categories, and other information, for every theme a developer has created.

In the “wp-config.php” file which resides in the WordPress root folder, simply paste the line below, which will instruct the Dashboard to enable the WordPress Networks feature and provide a configuration control panel to configure its settings and proceed:

define(‘WP_ALLOW_MULTISITE’, true);

Save the file and navigate to the WordPress Dashboard, where a “Network Setup” link will appear in the sidebar beneath the “Tools” heading. Within this setup dialog, be sure to select whether blogs will be installed into a subdomain or subfolder, and set a directory for uploaded media. Proceed to the next portion of the setup, which will have the WordPress Dashboard print a few lines of code which must be pasted into the “wp-config.php” and “.htaccess” files in the server’s root directory.

Return to an FTP client to make these changes, ensuring that every line of code is properly copied and pasted and all parentheses and semicolons are present. Failure to ensure proper code in either file will result in all sorts of website and WordPress errors which can severely limit website functionality.

It should be noted that the “.htaccess” file is often hidden from view when using a traditional FTP client and, if this is case, users should navigate to their cPanel, Plesk Panel, or other server control panel software and edit the file using a web-based file manager. These web-based applications are able to view and edit hidden folders when traditional FTP clients are not.

Step 3: Create a Blog for Each WordPress Theme Demonstration

The advanced coding part of the process is now over, but the most tedious aspect of creating a WordPress theme demonstration site still needs to be completed. The way this method works is pretty simple: Every theme which will be demonstrated to users must be displayed on a completely new blog, accessible via subfolder or subdomain. That means a theme developer must return to the WordPress Dashboard and begin the process of creating as many blog as they have created themes; each blog can be setup and accessed by using a special WordPress Network Dashboard which is sort of a “sub-Dashboard” within the traditional WordPress control panel.

Within this Dashboard, select the blog which is to be themed with a new template and click on “Appearance” in the sidebar. Simply locate the theme which needs to be demonstrated and activate it on the blog .Be sure to write a few example entries so that users can see all of the theme’s functions in action, and then repeat the process on the next blog so that the next theme can be demonstrated.

Enterprising developers may be a bit relieved to learn of plugins which can help with this process.

The first plugin, known as href="http://wordpress.org/extend/plugins/multi-site-user-replicator-3000/" target="_blank">Replicator, can be used to instantly create a large number of multisite instances without individually setting up each one over a long period of time. The plugin is installed and activated in the non-Network Dashboard for use with multisite blogs; when used, a developer can determine basic blog settings which will apply to number of blogs they’re about to create. Those settings will be universal, but they’ll still have to manually determine the theme used by each multisite iteration.

A second plugin is known as the href="http://wordpress.org/extend/plugins/diamond-multisite-widgets/" target="_blank">Diamond Multisite Plugin, and this is used because it contains a helpful sidebar widget that will increase a site’s usability. This widget actually lists, in alphabetical order, every multisite blog created by the WordPress Dashboard. When placed into the theme demonstration sites’ sidebars, it allows users to easily navigate directly between themes, rather than returning to the site’s index page every time they wish to preview a different theme in action on the developer’s website. It’s certainly not required but enhancing usability can only help increase a website’s bottom line and help to promote the adoption of its WordPress theme designs.

An Alternative Approach: Installing Multiple WordPress Iterations

There’s really no reason to leave the WordPress Networks feature behind in favour of manually installing many WordPress installations to serve as previews.

However, a number of theme developers to prefer to keep things a bit more “old school” when crafting these sites, and they’ll be reassured to know that WordPress can be installed multiple times on one server. For those with multiple databases, it’s easy: Simply create a new database for each WordPress installation, install the WordPress PHP flies into a new subfolder each time, and proceed through the setup and theming process as per normal. Then link to that new installation from the site’s index page, and everything is taken care of.

For those who have only one database, however, the “wp-config.php” file will again need to be updated in order to accommodate multiple installations for the purpose of demonstrating themes. This requires just a simple change to the file which determines a new database prefix for each installation. This ensures that the theme demo sites won’t overwrite the data and users present in the site’s primary installation. It’s done by modifying the line below, which appears near the top of every “wp-config.php” file, as shipped with a WordPress software download:

$table_prefix = ‘wp_’;

For ease of use, simply rename the “wp_” prefix to the all lowercase name of the theme which will be demonstrated using that particular installation. This will promote clarity when navigating the tables or cells using database software like phpMyAdmin.

Because these sites will all be accessed by the same administrator, it’s worth noting that WordPress can actually access the user and password data of other installations using a simple hack placed into the “wp-config.php” file. This will allow a developer to log into every installation with the same username and password, and it will ensure that they’re kept logged in to every installation simultaneously. The two lines of code needed to accomplish this are:

define(‘CUSTOM_USER_TABLE’, $table_prefix.’wp_users’);
define(‘CUSTOM_USER_META_TABLE’, $table_prefix.’wp_usermeta’);

Remember that the “wp_” prefix here can be changed to anything, and should line up with the primary installation’s database information for the best results.

Another Alternative Approach: Using WordPress Plugins to Demonstrate Themes

class="alignright" alt="WordPRess Plugin" src="http://www.webhostingsecretrevealed.net/images/2012/0525-4.jpg" width="230" height="125" />
The community of WordPress developers is appropriately broad and diverse, and some of them have figured out a way to demonstrate themes in action without installing multiple blogs, creating a WordPress Network, or hacking any database settings. Instead, they rely on custom functions designed in a WordPress plugin to display these demo websites to users, largely in the same way that the WordPress Dashboard can show a live preview of the site before finalizing the activation of a theme.

The most popular plugin is known as href="http://wordpress.org/extend/plugins/wordpress-theme-demo/" target="_blank">WordPress Theme Demo Plugin and, while its title is not necessarily creative, its approach is both creative an common sense. The plugin essentially brings the theme preview window out of the Dashboard and into real world use. The site’s users and shoppers can preview any of the site’s themes by navigating to a simple URL constructed as such:

http://your-domain.com/preview_theme?theme-name

This preview URL turns the theme’s all lowercase folder name into a preview destination; any theme folder name can be attached to the end of the link so that it can be previewed by a user. The system is ingenious, and it’s by far the most efficient way to preview themes. No database hacks are required, and users will not need to make any modifications to the WordPress “wp-config.php” file for this URL to be fully functional. Simply upload the plugin, activate it, and begin linking to theme previews using the above URL construction. A theme demonstration site can be deployed in mere hours using this method.

This plugin also allows a full list of all site themes to printed either in the sidebar or on a separate page (or post) entirely. This is much like the Diamond MultiSite Plugin widget, but is done using a simple variable. Wherever the list should appear, developers can simply insert the following bracketed WordPress variable:

[theme_list]

A full and alphabetized list of themes will be presented using a < ul > format; it’s important to remember that every theme uploaded to a site will be placed in this list, including the site’s default theme and any which are currently under development or revision. Be mindful of the themes which are uploaded, and remove any that are not for sale or preview by customers.

Easy to Do and Rewarding in the End

class="border" alt="WordPress Demo Site" src="http://www.webhostingsecretrevealed.net/images/2012/0525-5.jpg" width="750" />

A WordPress theme demonstration site takes those small and useless thumbnails to the next level, allowing customers the ability to actually interact with design elements and judge whether or not the theme they’re about to download or buy is right for their needs. It means overall better customer satisfaction and a higher likelihood that themes will be used or bought by avid WordPress users and novice designers. The process is simple to complete, and it can be quite rewarding for enterprising and engaging theme designers.


Page 24 – Web Hosting Secret Revealed




How-to Clean Up Old Blog Posts and Increase Site Traffic



alt="How-to Clean Up Old Blog Posts and Increase Site Traffic" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/11/matt-cutts-500x281_c.png" />

Would you go two or three years without cleaning your house? Then why would you go that long before cleaning your blog? If your blog has been around for more than two seconds, you likely have a collection of older posts. According to Moz, Google tweaks its algorithm about 500 to 600 times a year. In addition, since 2011, they’ve instituted some major changes, including Panda, Penguin and the latest big roll out, Hummingbird. Needless to say, older posts may have been written to SEO requirements that are now obsolete and may even hurt your blog’s rank in the search engine.

Matt Cutts, software engineer and Google spokesperson, explains just how often Google tweaks their algorithm in the video below.

src="//www.youtube.com/embed/K-022hPWU54?rel=0" height="422" width="750" allowfullscreen="" frameborder="0">

If Google is tweaking their algorithm daily, it becomes important to review old content and update it to meet Google’s latest algorithm standards.

Chasing Rabbit Trails

You may be thinking to yourself that if Google makes changes so often, fixing old content is just chasing a rabbit trail because there will be even more changes in a week, a month, or a year.

You would be correct, if you were only trying black hat SEO tactics or not worried about offering quality content. However, what I’m advocating is tweaking old articles to get rid of things that we know will give your site a hit in the rankings or that readers no longer appreciate. Your goal should be to improve the overall site visitor experience. Google does a ton of research to determine what people want out of a search engine, including hiring live people to browse sites for them and report back. Google’s algorithms can be useful in determining what the general public wants from all sites and thus can help you improve your site.

id="attachment_7509" style="width: 760px" class="wp-caption aligncenter">href="http://www.webhostingsecretrevealed.net/blog/seo/how-to-clean-up-old-blog-posts-and-increase-site-traffic/attachment/rabbit-trails/" rel="attachment wp-att-7509">class="size-full wp-image-7509" alt="rabbit trails" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/11/rabbit-trails.jpg" width="750" height="300" srcset="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/11/rabbit-trails.jpg 750w, http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/11/rabbit-trails-300x120.jpg 300w" sizes="(max-width: 750px) 100vw, 750px" />class="wp-caption-text">photo credit for unedited photo: href="http://www.flickr.com/photos/porsupah/4672601977/">-Porsupah- 

What to Change?

We’ve covered the major algorithm changes you need to be aware of here on Web Hosting Secret Revealed, such as href="http://www.webhostingsecretrevealed.net/blog/seo/top-lessons-you-can-learn-from-googles-new-hummingbird-algorithm-changes/" target="_blank">Hummingbird changes and href="http://www.webhostingsecretrevealed.net/blog/seo/post-penguin-and-google-analysis/" target="_blank">what to do post-Penguin. You should take some of the big changes into consideration as you go back and clean up your old posts and optimize your site.

Balance Speed and Big Images

There are two things you have to consider. First, studies show that larger product images can increase sales. In an href="http://visualwebsiteoptimizer.com/split-testing-blog/larger-product-images-increase-conversion-rate/" target="_blank">A/B test at Mall.cz, different sizes of product images were tested. The results of the split test showed that larger product images resulted in 9% more sales.

At the same time, Google does look at speed. Not only does the average website visitor get frustrated if your site takes more than a few seconds to load, but Google may knock you down in search rankings if your site is slow to load.

“In 2010, Google did something very different. Google announced website speed would begin having an impact on search ranking. Now, the speed at which someone could view the content from a search result would be a factor.” — Mark Isham, CEO of Zoompf, on href="http://moz.com/blog/how-website-speed-actually-impacts-search-ranking" target="_blank">The Moz Blog

What does all this mean to you? Not only do you have to add larger images, but you have to make sure they are website optimized so they load quickly. While adding a couple of large images can help, overwhelming the page with images will slow down load speed and may hurt you more than help you. You’ll also want to make sure that you choose a web hosting company that has strong enough servers to let your pages load quickly, such as one we recommend called href="http://www.webhostingsecretrevealed.net/hosting-review/a2-hosting/" target="_blank">A2 Hosting, who even allows you to speed your sites up more with add-on packages.

Make Sure the Post Has Value

Is your post still relevant? If you added some thoughts about 9/11 the day after it happened, you may need to update this post. Jodi, over at href="http://rantsnrascals.com/author/admin/" target="_blank">Rants ‘N’ Rascals writes:

“Simply update your posts by adding in new keywords, cleaning up your photos and adding relevant information for how your blog is geared today.  If all else fails and the post is of no value then ditch it.”

Keep this handy checklist by your side to help you determine what needs to go, what needs to stay and what needs changed:

  • _____ Is the post still relevant or does it need updated with current news?
  • _____ Do all the links still work?
  • _____ What keywords on this topic are currently trending? Do I need to change my wording?
  • _____ Are the images big enough? What can I add or delete to make the appearance better?
  • _____ Is the page mobile browser friendly?
  • _____ Does the article cover every angle of the topic?
  • _____ Does the article do a better job than other articles on this topic? Does it offer something more?
  • _____ Does the formatting on the old post match that of the new posts or have I changed to bigger headers and more bullet points? If so, make some changes to help the old posts match the newer posts.

Be Careful Where you Link

id="attachment_7523" style="width: 310px" class="wp-caption alignright">href="http://www.webhostingsecretrevealed.net/blog/seo/how-to-clean-up-old-blog-posts-and-increase-site-traffic/attachment/broken-link-checker-box/" rel="attachment wp-att-7523">class="size-full wp-image-7523" alt="broken link checker" src="http://whsr.webrevenueinc1.netdna-cdn.com/wp-content/uploads/2013/11/broken-link-checker-box.png" width="300" height="280" />class="wp-caption-text">Broken Link Checker plugin description

No one, outside of Google’s inner circle, is 100% certain just what Google’s algorithm is. Even if you do know the exact formula, you can be certain it will change tomorrow. With that in mind, sometimes you have to use a little common sense to come to a conclusion or two.

If Google penalizes for backlinks from certain sites, doesn’t it make sense that they might also penalize for links to certain sites? With that in mind, go back through your old posts and see where you are linking out. Here are some things you should watch for that might make your ranking take a hit:

  • Too many links to affiliate sites like Amazon. Google can read this as a spammy page.
  • Links to sites that are seen as spam.
  • A link heavy page that might simply draw your readers away from your own site.
  • Not enough links to articles on your own site (aim for one or two per post).
  • Dead links that go to sites no longer there or links that do not work because of coding. Good news. If you use WordPress, you can use a simple href="http://wordpress.org/plugins/broken-link-checker/" target="_blank">broken links plugin to automatically notify you of broken and dead links in all your posts.

Breaking it Down into Manageable Pieces

Cleaning up your website can seem like a task you might never complete. However, breaking the job down into manageable pieces can help you stay up-to-date without taking too much time away from creating new content.

  • Automate whatever you can. For example, the broken link plugin keeps you from having to check manually for broken links.
  • You can also check your site’s stats to see which pages are getting little traffic and look only at a few of the bottom traffic posts each month, fixing them as you go along.
  • Time yourself when you are fixing the first few posts. You can use a free source, such as href="https://www.toggl.com/" target="_blank">Toggl.com to time yourself or simply use an online stopwatch. Take the time for the three posts and average it. Once you know how long it takes you to edit an old post, you can better figure out how much time you can devote to site edits and thus how many articles a week you can update.
  • Consider hiring someone to do the updates for you. You can create new content while they edit your old posts and help increase your traffic.
  • Come up with a plan to make sure you don’t re-edit the same posts over and over. Whether you print out a list of articles and cross them off, start at the end of your list of posts or go in alphabetical or chronological order, pick a plan and stick to it.

Some posts will be faster edits than others. You may also want to choose a cut off point where you know the most recent posts are up-to-date with current SEO tactics.

Planning Ahead

You can save yourself a lot of time by spending a little extra time on the front end. href="http://www.webhostingsecretrevealed.net/blog/web-business-ideas/why-good-content-should-be-at-the-heart-of-your-link-building-campaign/" target="_blank">Create excellent content that answers readers’ questions. Don’t use black hat tactics as those are frowned upon both by search engines and readers. Quite simply, provide the best content you can and be as upfront and transparent with your readers as you can and you will have fewer edits to do later on as the algorithms change again. At the minimum, you’ll have well written articles that simply need a quick adjustment to up the traffic they receive.


Page 16 – Web Hosting Secret Revealed