Ajeet Yadav – Web Design Ledger https://webdesignledger.com By Web Designers for Web Designers Fri, 13 Nov 2015 16:46:18 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://webdesignledger.com/wp-content/uploads/2015/08/cropped-Web-Design-Ledger-512x512-Pixel-32x32.png Ajeet Yadav – Web Design Ledger https://webdesignledger.com 32 32 PHP 7: What’s New & How Will It Affect a WordPress Site? https://webdesignledger.com/php-7-whats-new-how-will-it-affect-a-wordpress-site/ https://webdesignledger.com/php-7-whats-new-how-will-it-affect-a-wordpress-site/#comments Thu, 12 Nov 2015 17:39:07 +0000 http://webdesignledger.com/?p=32635 PHP 7, a major update to the server-side web development language PHP, is right around the corner. According to PHP 7 project timetable mentioned on PHP.net wiki, if everything goes as planned, its final version will be released on Nov 12, 2015. Meanwhile, you as a future user may consider playing around with the latest […]]]>

PHP7

PHP 7, a major update to the server-side web development language PHP, is right around the corner. According to PHP 7 project timetable mentioned on PHP.net wiki, if everything goes as planned, its final version will be released on Nov 12, 2015. Meanwhile, you as a future user may consider playing around with the latest beta to have an overview of what features the new version of PHP offers and how it will shape up and affect your development work.

If you’re a website developer/owner running their sites on WordPress (or on any other PHP-powered CMS such as Joomla, Drupal, Magento), then you’ve landed to the right blog post. This informative guide will not only give you a taste of what’s new coming in PHP 7 but also will answer all your questions related to the new PHP version!

Wordpress-php7-performance

Drupal on PHP7

Let’s dive in!

What’s New in PHP 7?

First of all, let’s take a closer look at some of the exciting features and improvements that you’ll see in PHP version 7:

Huge Performance Improvements:

PHP has always been criticized for performance-related issues, which is greatly improved in PHP 7. Even, the poor performance of PHP prompted Facebook to build HHVM – a virtual machine designed to maximize the performance of PHP based applications. Since the new version of PHP is based on the PHPNG project (PHP Next-Gen), it gives up to 50% boost to real-world apps and performs faster than HHVM.

Twice as fast as Previous Versions:

PHP 7 is almost 2X faster than PHP 5.x. It not only executes your code faster but also requires fewer servers to handle the same amount of requests per second. As an example, the WordPress homepage now requires 72% lesser CPU instructions to execute than before. That’s because PHP 7 receives a brand new version (refactored) of Zend Engine, which adds a significant speed enhancement to the language.

New Operators:

PHP 7 introduces two new operators: Spaceship (Combined Comparison) and Null Coalescing. Where the Spaceship operator (<=>) makes your chained comparison more concise, on the other hand, Null Coalescing (??) operator is used to check if something exists. However, these both tasks could be accomplished before, but probably not in all conditions.

Return & Scalar Type Hints:

In the new PHP version, developers would be able to use Booleans, Strings, Floats and Integers as type hints for functions. Also, they’ll be allowed to declare the return type of a function. This will save them passing and returning wrong types from functions, which may lead to unpredictable behavior in code.

Engine Exceptions:

Handling existing fatal and recoverable fatal errors has always been a herculean task for PHP developers. But now, exceptions implemented in the brand spanking new Zend engine will facilitate error handling in your application. The new Engine Exceptions will replace these kinds of errors, making it possible for developers to catch all fatal errors and take appropriate action immediately.

Consistent 64-Bit Support:

Even though the native environment of PHP is Linux, but still you can run it on a Windows-powered system. Since the previous versions of PHP doesn’t have support for a large file or 64-bit integer, the x64 builds of PHP for Windows have been considered experimental yet. To the contrary, version 7 features consistent 64-bit support that enables you to confidently run PHP on a 64-bit Windows system.

Group Use Declarations:

PHP 7 introduces a new concept, called Group Use Declarations, which dramatically improves the implementation of PHP namespace. The new syntax makes it possible for you to import multiple classes from the same namespace. Needless to say, this new feature will save you a lot of typing time and also make your code shorter and readable.

Supports Anonymous Classes:

Like other programming languages such as Java and C#, the new version of PHP enables you to use anonymous classes in your code. An anonymous class is a class with no name. When used properly, anonymous classes can not only improve your coding but also can speed up execution time to a great extent.

Abstract Syntax Tree (AST):

Another big change made to PHP core is the use of Abstract Syntax Tree (AST) as an intermediary stage in the language compilation process. This improvement would mainly be visible to developers and not have any direct impact on userland code. There are several advantages of using AST, including the potential for more optimizations, the scope for utilizing tools like static code analyzers and better code quality etc.

Deprecated Items Removed:

To make PHP even faster, a number of deprecated functionalities and dead or unsupported Server APIs and extensions have been eliminated from the version 7.  Some of the items that are removed from PHP 7 are PHP4 style constructors, ASP style tags, ereg and MySQL extensions etc. For more details, you may check out removed deprecated functionalities in PHP7.

But, where is PHP 6?

After getting acquainted with the exciting features of PHP 7, you would definitely want to know why PHP moved to version 7 from version 5. What happened to version 6? Well, PHP 6 was an experimental project that was officially started in 2005 and unfortunately abandoned in 2010. One of the main reasons behind the termination of version 6 was technical difficulties faced by PHP core developers during the implementation of language-integrated Unicode.

Meanwhile, people around the web adopted the name PHP 6 and started writing books and developing resources related to version 6. Since there might be confusion between the former attempt and the current development work, the PHP core team was compelled to seriously think about the name of the new major release. And finally, the development team decided to skip the logical number 6 and launch the new version under the name of PHP 7.

How Can PHP 7 Really Affect Your WordPress Site?

Despite the fact that WordPress core development team is continuously working on making the CMS ready for PHP7, the latest version of PHP can break your site. The reason is the incompatibility of themes and plug-ins with PHP 7. Even though WordPress has suggested theme and plugin authors to get familiarize with all backward incompatible changes and update things accordingly, most of the themes and plug-ins are not yet ready for the upcoming release of PHP 7.

Since WordPress has started fixing every possible issue related to PHP 7, more and more people are now taking necessary steps toward making their themes and plug-ins compatible to PHP 7. For instance, the author of Simple Social Icons has already updated the plug-in to make it PHP 7compatible. That means, soon after PHP 7 official release, not only WordPress would fully support PHP 7 but also all themes and plug-ins would have been updated to work with version 7. In a nutshell, consider upgrading your site to PHP 7 only when you found everything – hosting server, themes, plug-ins and WordPress – compatible to version 7.

Crucial Things to Consider When Migrating from PHP 5 to PHP 7

So if you’ve decided to move your WordPress site from PHP 5 to PHP 7 right after the official release of version 7, here are some best practices that you should follow to prevent any issues before, during and after migration:

Watch for Notifications:

Before implementing any PHP update, most of the hosting providers send a notification to site owners. The purpose of this notification is to make you inform about the update so that you could keep a look out to see if something goes wrong. So continuously watch for notifications and inform your hosting provider immediately if you found anything wrong.

Backup Your WordPress Site:

Even if you’re fully confident that the PHP update will not break your website, it’s always good to have a fallback plan. Whether or not you receive the notification from your hosting provider, always have a saved copy of your site on multiple locations. This will save you from any unforeseen disaster that may occur during migration.

Keep Everything Updated before Migration:

Before moving to PHP 7 from PHP 5, update all elements – including themes, plugins and WordPress itself – related to your WordPress site. This will prevent these (and other) elements from stop working after PHP gets updated. Also, if a certain element is not compatible with the new version of the language, it’ll no longer function.

Contact Your Hosting Provider:

For further help, you may consider contacting your web host’s support team. In case, your web host is unable to completely resolve your issues, then install a new copy of WordPress and restore your site from a backup.

Author Bio
Ajeet is a senior web developer at WordPress Integration – PSD to WordPress service provider, where he is responsible for writing custom JavaScript code during the conversion process. In his spare time, he writes on different topics related to WordPress, JavaScript and Web Design to share his work experience with others. You can follow WordPressIntegration on Facebook

]]>
https://webdesignledger.com/php-7-whats-new-how-will-it-affect-a-wordpress-site/feed/ 6
Things to Consider when Developing a WordPress Theme Framework https://webdesignledger.com/wordpress-theme-framework-tips/ https://webdesignledger.com/wordpress-theme-framework-tips/#comments Mon, 14 Sep 2015 21:30:29 +0000 http://webdesignledger.com/?p=31139 Over the last few years, WordPress theme frameworks have gained tremendous popularity among both end-users and developers. They make it possible for users to create a unique and flexible site with absolutely no coding experience. But on the other hand, they also provide developers the simplest, quickest and most efficient way to build custom WordPress […]]]>

Over the last few years, WordPress theme frameworks have gained tremendous popularity among both end-users and developers.

They make it possible for users to create a unique and flexible site with absolutely no coding experience. But on the other hand, they also provide developers the simplest, quickest and most efficient way to build custom WordPress themes.

For any reason if you’re not satisfied with your current WordPress theme framework and planning to build your own custom framework, then you’ve come to the right place. This must-read guide takes a glimpse at key considerations that you as a developer should take into account when writing your own theme framework.

Let’s begin!

Usage Context

The first and foremost thing you need to determine is the context in which your framework will be used.

Before going to write any code for your framework you must have a clear idea of who your target audience is. Figure out whether your theme framework is just for your personal use or for others. If it is for others, then who will use it – developers or non-technical users?

Remember, the way your framework will be used has a great impact on what features and functionality you include in it.

The Parent and Child Themes

The parent theme is one of the key components of a theme framework which can be designed in one of two ways: as a stand-alone base/starter theme or as a “drop-in” code library that only works in conjunction with child themes.

The way you adopt totally depends on your framework requirements; however, I recommend you create at least one starter child theme. This will not only help you avoid a lot of code repetition work but also give you the ability to develop custom themes fast.

Later you might consider creating multiple child themes in accordance with different types of projects.

WordPress Coding Standards

Whether you’re developing a theme, plug-in, framework, or any other thing in WordPress, make it a habit to follow WordPress Coding Standards. This is crucial to avoid common coding errors, improve code readability, and simplify further modifications.

If you don’t do so then no one will be able to understand and edit your code.

Besides, if you’ve planned to submit your framework as a theme to WordPress theme directory, you must meet all of the theme review guidelines. Keep in mind that even the world’s most beautiful framework can’t impress developers unless the code is well-structured and thoroughly commented.

Action and Filter Hooks

Hooks allow your framework to hook into when adding any custom code or changing the way how a particular theme or plug-in behaves. There are two kinds of hooks in WordPress: Actions and Filters.

Where Action hooks let you add your own code to template files without creating any duplicate files, filter hooks allow you to change the output by your template files.

So when developing your theme framework take some time to decide which content you want to include in it via hooks and what content you’ll code directly in your template files.

Custom Functions

Your framework may also include a range of custom functions, some of which will hook into your already defined Action and Filter hooks while others will be used by child themes via functions.php file to override the inherited characteristics from its parent theme.

You can add any custom functions which you think are useful to your framework. Doing so will save you from writing a lot of duplicate code in future.

By making use of add_action() function in your child theme, you can activate your favorite functions from the parent theme at any time.

Scripts Integration

If a particular script will be used by multiple sites or if you want to empower your non-technical users with some extra options, you may consider integrating certain scripts such as jQuery slider or light box with your theme framework.

This way you(and your users) will not be required to install extra plug-ins for desired functionality.

However, including scripts in your framework will add a huge amount of unnecessary code to it. To avoid code bloat, I suggest you to develop separate plug-ins for these scripts and use them only when required.

Theme Options Page

The theme options screen which is an integral part of any complex WordPress theme proves to be extremely useful when you’re developing your framework for non-technical users.

It not only allows users to activate or deactivate scripts included in the framework, but also enables them to make various theme customizations like adjusting font size, adding custom fields, altering theme colors, etc.

For many of your options, you may give users access to the theme customizer through which they will be able to see their changes in the live mode. In my opinion, including both customizer and theme options screen in your framework would be much better.

Menus and Widgetization

Before you start coding decide how many menu areas you want to include in your framework. If your framework is for non-technical users then I recommend adding more than one area for menus so that visitors can easily navigate the site.

Also depending on your audience, consider adding a range of widget areas to your framework.

However if your framework is just for you or for a small team of developers, you may skip adding any widget areas. But in case of non-coders, it’s quite crucial to include multiple widget areas in various sections of your framework to provide users a lot more flexibility.

Flexibility and Extendibility

Would the framework you’re developing be able to stand the test of time? Would it be compatible with future releases of WordPress? Would it meet all your needs for future builds?

Ask yourself such questions to make your framework as robust and future-proof as possible.

Instead of limiting yourself to theme options screens, tap into the API so that you or your users could easily extend the framework for a range of sites in future. Keep in mind, a good framework is the one that gives you wings – flexibility and extendibility – to fly.

Documentation and Support

Extensive documentation and consistent support must not be overlooked at any cost. Where detailed documentation helps you keep track of each and every element in your framework, high-quality support provide answers to users’ questions.

Apart from the standard documentation I highly recommend you create some tutorials and videos to help users get start with the framework fast.

For better support you can create a discussion forum or a website with documentation.

Hopefully these tips will help you master WordPress and create functional, extensible, and well-designed frameworks for all audiences.

]]>
https://webdesignledger.com/wordpress-theme-framework-tips/feed/ 1