How to Create a Multilingual WordPress Site

Have you ever wondered what it would take to create a multilingual WordPress site? After all, your site visitors are from across the globe and likely speak many different languages than the primary language your website displays.
Well, today we are going to take it down a notch and give you just the basics. Keep reading to find out why you should consider translating your website’s content and how to create a multilingual WordPress site using the ever-popular WPML translation plugin.

StudioPress Sites – WordPress on Autopilot. Powered by Genesis.

StudioPress is about to drop a service that is going to make your dreams come true. It’s called StudioPress Sites. It’s an all-in-one WordPress solution based on the Genesis framework. All-in-one means it covers everything from hosting, to security, to one-click installs of OptinMonster, Beaver Builder Lite, and more.

The post StudioPress Sites – WordPress on Autopilot. Powered by Genesis. appeared first on WPLift.

Logging Into WooCommerce.com Now Requires a WordPress.com Account

If you logged into WooCommerce.com over the weekend, you may have noticed a distinct change. In order to sign into the site, users are now required to have a WordPress.com account. The change occurred without warning and surprised those who manage multiple WooCommerce stores for clients.


WooCommerce Login Screen Requiring a WP.com Account

Brad Griffin, who maintains a number of client sites that run WooCommerce, raised concerns over the change in a post on the Advanced WordPress Facebook group.

“When dealing with businesses, asking someone at a corporate level to take their email address and make a WordPress.com account is a bit problematic,” Griffin said. “They’re confused as to why they need to do this. They don’t have immediate access to that email address on a Saturday or Sunday.”

“So, without warning, without notice, without a heads up or anything else, no one can now access anything in the back-end of the WooCommerce account unless there is a WP.com single sign on account using oAuth.”

For those not interested in signing in with their WordPress.com account, WooCommerce.com attempts to alleviate concerns in an article that outlines the benefits. The benefits include an option to enable 2-Factor Authentication, access to eCommerce services, and viewing purchase history.

After speaking to Todd Wilkens, Head of WooCommerce at Automattic, Griffin published video, explaining the change and offers suggestions for those who manage multiple WooCommerce stores for clients. The suggestions are:

  • Make 100% sure that you, your client, your store, your account, or anything else has a WordPress.COM account ~ not just WordPress.org!
  • Once you’ve used an email and login and you are setup for WordPress.COM (not .org), make absolutely certain that you are using an incognito browser window when logging into WooCommerce.com.

Using a private or incognito browser window won’t remember the login as the cookie is not saved. If you don’t use incognito mode and like, comment, or subscribe to items on WordPress.com or any site that uses WordPress.com’s oAuth protocol, those actions will occur under the client’s account. “Many users might not fully realize how far-reaching that one little oAuth endpoint actually is and the vastly significant number of touch-points it can affect,” Griffin said.

Wilkens published a post on the official WooCommerce blog explaining why the login system was switched, “We found that a lot of customers were using two accounts to access services from one company,” he said.

“To simplify that, we are centralizing on the WordPress.com login. Automattic has done this with previous acquisitions, like Polldaddy, for the same reasons. Now you can use only one login to access all Automattic services, including WooCommerce, Jetpack, VaultPress and more.”

So far, the WooCommerce team has tracked more than 10K successful logins to the new system and are monitoring feedback on social media. Only a small subset of users have reported issues due to confusion, “Over half of the 1% of users who opened tickets were confused between having a WordPress.com login vs. the login they use for their self-hosted WordPress install,” Wilkens said.

A Better Way to Manage Multiple Client Accounts Is in the Works

WooCommerce.com joins a growing collection of Automattic services, sites, and products that require a WordPress.com user account. As the number of reasons to have an account increases, perhaps it’s time for Automattic to create a client management system. A system that allows users to assign people who can act on their behalf, similar to a power of attorney.

An example that comes to mind is GoDaddy Pro. GoDaddy Pro allows consultants to access all of their client’s products in one place. They can also manage aspects of their hosting and purchase products on their behalf.

The change to WooCommerce.com has emphasized the unfriendliness of the site’s current system for those who manage multiple client accounts. “We had already re-prioritized a number of features on our roadmap to make life for developers managing dozens of client accounts much smoother, and hope to have something to be able to announce there soon,” Wilkens said.

If you manage multiple client accounts and are affected by this change, Wilkens suggests opening a ticket for advice. You can also provide feedback by voting on a poll at the bottom of the post that asks how your experience was switching to a WordPress.com login.

Creating Incentivized Optins With Easy Digital Downloads Discount Codes

A lot of WordPress plugins, including Easy Digital Downloads and WordPress SEO offer discount codes in exchange for allowing anonymous usage tracking. It’s a smart offer to make as the data is valuable. But, it’s also a great option for users of the plugin.

This article is based on my experience setting up such a system for my plugin Caldera Forms. I will show you how I set up Easy Digital Downloads (EDD) on our site to dynamically generate the discount codes. I will also show how I set up the emails that provide the codes.

This should be a useful tutorial for those looking to learn how to work with EDD discounts programmatically and for a practical example of how WordPress’ psuedo-CRON system works.

Though I’m not covering it in this article, you may be interested in learning how to capture user emails of your plugin. For more information, you can check out posts from Freemius and WordImpress.

Getting Started

To begin, you will need to integrate a simple form into your site that makes a POST request to an external URL and sends the user’s email address along. Make sure that form is well integrated with your user interface and that you have an option to decline tracking that prevents the offer from being shown again.

Once that’s ready, create a must use plugin (mu-plugin) on your site. I like using a mu-plugin for this as it allows me to act very early. This reduces the amount of time the request takes. When someone opts into usage tracking, that request to the Caldera Forms site happens all in the background and there is no need to load the theme or anything.

Also, I always want this system to be turned on, thus “must use” plugin.

Before you start, make sure to create two HTML files for your emails. I used Bee to create the HTML for my email. The important thing to do is use an easily substituted placeholder in your email for the actual code.

The System

This is a pretty simple system, so I built mine all in one file of the mu-plugin. Your’s may get more sophisticated and require a directory, and that’s OK. Just remember, mu-plugins don’t load like regular plugins, you need a file in the root of mu-plugins that includes files in the folder.

The first version of what I did only had two functions, both of which I built in. Later I added tracking of emails in a custom table. I did that for two reasons. First I wanted conversion tracking and two I needed a way to prevent multiple emails from being sent to the same person. For now, I’ll just show you the basics.

The first function, which is hooked into it does four things. First, it validates the incoming request, then if that passes it creates the discount code. Then it sends an email with that code in it, and then it schedules the second email to be sent in a week. The second function is the callback for the wp-cron event that sends the second email.

Before I cover how these work, let’s do a quick primer on WP-CRON which is essential to this system.

WP-CRON Basics

Servers have a system called CRON that is used for scheduling tasks that need to run at a later date. WP-CRON is a system built into WordPress designed to handle scheduled tasks in a CRON like fashion.

The important distinction is that because CRON is a program running on your server it can run a task at exactly the time or interval it is set at. WP-CRON is part of your site and it can only run when a request is set. Therefore it’s important to keep in mind that when scheduling a WP-CRON event, you’re not saying “do this at X time.” You’re saying “do this as soon as possible after X time” and the earliest that will happen is after the first request to your site that happens after X time has passed.

WP-CRON is built around the WordPress hook system, but with delayed actions. Normally when you use add_action() the callback you use is executed in the same session, as soon as do_action() is called for that hook. With WP-CRON, you still use add_action for your callback but you specify a delay until that action is triggered.

Think of this as wp_schedule_single_event() as a delayed action. Instead of doing the action right away, you do it sometime in the future. Take a look at this example:

<?php
//do the action ten_minutes_later_hook 600 seconds from now -- IE ten minutes.
wp_schedule_single_event( time() + 600, 'ten_minutes_later_hook' );
/** The CRON Callback */
add_action( 'ten_minutes_later_hook', function(){
//it is now ten minutes later
});

This is a one-time event, we could have also used wp_schedule_event() to create a recurring task, but that’s not needed here.

The other thing we could have done is passed data to the callback. That is done with the third argument of wp_schedule_single_event(). Keep in mind, this data gets stored in the database, and therefore affects performance. So if you need a WP_Post object in the event callback, it is better to just pass post ID, and get the post object back in the callback, like in this example, which will change a post’s status 4 weeks after it was created:

<?php
add_action( 'save_post', 'my_update_post' );
function my_update_post( $post_id ) {
if ( wp_is_post_revision( $post_id ) ){
return;
}
wp_schedule_single_event( strtotime("+1 week"), 'my_change_status' );
}
add_action( 'my_change_status', 'my_change_status' );
function my_change_status( $args ){
if( isset( $args[0] ) && is_object( $post = get_post( $args[0] ) ) ){
$post->post_status = 'old';
wp_update_post( $post );
}
}

The First Email

The first email is sent as soon as the initial request is sent. As I said earlier, we will need to validate the incoming request and create an EDD discount code.

Discount codes in EDD are generated using the function edd_store_discount(). Here is how I create a 10 percent discount code, using a random string. Notice that I use the user’s email address as the name of the discount. This was a design decision I made for tracking purposes, it is not technically necessary.

<?php
add_action( 'init', function(){
  //Don't do anything if wrong type of request
if( ! isset( $_POST[ 'optin-email' ] )  ){
return;
}
  //Return error if bad email
if( ! is_email( urldecode( $_POST[ 'optin-email' ] ) ) ){
wp_send_json_error( [ 'error' => 'email-invalid' ] );
}
  //Sanitize email
$email = sanitize_email( urldecode( $_POST[ 'optin-email' ] ) );
  //Create random discount code
$pool = array_merge(range(0,9), range('a', 'z'),range('A', 'Z'));
$code = '';
for($x= 0; $x < 3; $x++) {
for ( $i = 0; $i < 5; $i ++ ) {
$code .= $pool[ mt_rand( 0, count( $pool ) - 1 ) ];
    }
$code .= '-';
}
$code = 'thanks-' . rtrim( $code, '-' );
//Set expiration time -- 604800 == week in seconds
$expires = time() + ( 2 * 604800 );
  //create code and get it's ID
$details = array(
'code'              => $code,
'name'              => $email,
'status'            => 'active',
'is_single_use'     => 1,
'amount'            => '10',
'expiration'        => date( 'm/d/Y H:i:s', $expires ),
'type'              => 'percent',
'max' => 1,
'uses' => 1
);
$id = edd_store_discount( $details, null );
  
  //Check for error
if( ! is_numeric( $id ) ){
wp_send_json_error( ['error' => 'Failed to create discount' ] );
}
  
  /** SEND EMAIL HERE **/
});

This takes us to the point where we have our discount code and its ID. We also have a sanitized email address — remember trust no inputs. Now we need to add in sending of the email and scheduling an event:

<?php
add_action( 'init', function(){
  //Don't do anything if wrong type of request
if( ! isset( $_POST[ 'optin-email' ] )  ){
return;
}
  //Return error if bad email
if( ! is_email( urldecode( $_POST[ 'optin-email' ] ) ) ){
wp_send_json_error( [ 'error' => 'email-invalid' ] );
}
  //Sanitize email
$email = sanitize_email( urldecode( $_POST[ 'optin-email' ] ) );
  //Create random discount code
$pool = array_merge(range(0,9), range('a', 'z'),range('A', 'Z'));
$code = '';
for($x= 0; $x < 3; $x++) {
for ( $i = 0; $i < 5; $i ++ ) {
$code .= $pool[ mt_rand( 0, count( $pool ) - 1 ) ];
    }
$code .= '-';
}
$code = 'thanks-' . rtrim( $code, '-' );
//Set expiration time -- 604800 == week in seconds
$expires = time() + ( 2 * 604800 );
  //create code and get it's ID
$details = array(
'code'              => $code,
'name'              => $email,
'status'            => 'active',
'is_single_use'     => 1,
'amount'            => '10',
'expiration'        => date( 'm/d/Y H:i:s', $expires ),
'type'              => 'percent',
'max' => 1,
'uses' => 1
);
$id = edd_store_discount( $details, null );
  
  //Check for error
if( ! is_numeric( $id ) ){
wp_send_json_error( ['error' => 'Failed to create discount' ] );
}
  
  //get discount code
  $discount_code = edd_get_discount_code( $id );
  //setup email
$from_name = 'Your Name';
$from_address = 'You@HiRoy.club';
$headers  = "From: {$from_name} <{$from_address}>\r\n";
$headers .= "Reply-To: {$from_address}\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
ob_start();
include( dirname( __FILE__ ) . '/emails/email-first.html' );
$message = ob_get_clean();
$message =str_replace( '{CODE}', $discount_code, $message  );
$sent = wp_mail( $email, 'Your Discount Code', $message, $headers );
if( $sent ) {
    //schedule reminder email
$send = $expires - 82800;
wp_schedule_single_event( $send, 'optinemail', [ $discount_code, $email ] );
wp_send_json_success( [ 'success' => true, 'error' => false ] );
}else{
wp_send_json_error( [ 'email' => 'Email did not send.' ] );
}
});

This schedules the event optinemail to run 12 days later. That event is going to run once per user, but each time, it will have a different email address and discount code, which were passed to the third parameter of wp_schedule_single_event().

The Second Email

Now that the event will be scheduled, we need a callback function. It will need to be hooked, using add_action to the “optinemail” hook. In our callback, we can expect two arguments — email and discount code.

I said “expect” because it is never safe to assume that any program is working right or any data coming out of the database is correct. That’s why we will want to validate and sanitize the email and code first, before sending the second email.

<?php
add_action( 'optinemail', 'send_second_email' );
function send_second_email( $args ){
if( isset( $args[0] ) && is_email( $args[0]) ){
$email = sanitize_email( $args[0] );
}else{
return;
}
if( isset( $args[1] ) && is_string( $args[1] ) ){
$code = strip_tags( $args[1] );
}else{
return;
}
ob_start();
include( dirname( __FILE__ ) . '/emails/email-day-before.html' );
$message = ob_get_clean();
$message =str_replace( '{CODE}', $code, $message  );
$from_name = 'Your Name';
$from_address = 'Josh@CalderaWP.com';
$headers  = "From: {$from_name} <{$from_address}>\r\n";
$headers .= "Reply-To: {$from_address}\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
$sent = wp_mail( $args[1], 'Last chance to use your Caldera Forms discount code!', $message, $headers );
}

Don’t Forget To Track

If you opt into Caldera Forms usage tracking, the email you receive has a lot of links. Every one of them has the right UTM tags for Google Analytics tracking. That is the minimum amount of tracking I would recommend.

I hope you will use this article and its example code as a start point for your own system. Make sure you’re providing real value to your users, tracking the results and not being spammy!

Josh is a WordPress plugin developer and educator. He is the owner and a developer for CalderaWP, makers of Caldera Forms, a different kind of and Ingotthe native WordPress A/B testing solution.

The post Creating Incentivized Optins With Easy Digital Downloads Discount Codes appeared first on Torque.

Creating a Donation Landing Page with Divi and Give

If you are a nonprofit organization and depend on online donations for your income, then most likely you’ve thought a lot about your donation page. This article will help you understand what makes for a great donation landing page and how to make it happen with the Divi Theme (or Extra Theme or Divi Builder plugin) and the Give Donation plugin.

Why Create a Landing Page for Donations?

Contrary to e-commerce and products, it’s not highly likely that you’ll have visitors that just find you on Google and suddenly donate. Consumers don’t need a strong relationship with the merchant in order to feel comfortable to purchase a product from them. But donors are not the same. Donors want to know your organization well. They want to know that you’ll use their money wisely and prudently. Most likely they are going to read all around your site for months before they finally click on that “Donate” button in your menu.

If that’s the case, why create a landing page at all? Why not just put a form anywhere and wait? The answer is simple: because your relationship with your donors matters.

In all likelihood, 90% of the effort of getting a donor to actually donate is done outside of the landing page. They might want to volunteer their time with your organization for a while before donating. They might read your blog or watch your videos for months before wanting to donate. Your relationship with them is going to take a long time; so when the point of donation comes, you don’t want to waste that opportunity. That’s why, when they finally decide to give you their money, you want to show them your best material and make the experience comfortable.

Landing pages are a great way to consolidate the most compelling information about your Cause or Campaign into one easily digestible format that leads your visitor directly to the donation form at the end. When they land on that page, they should see nothing but things that re-affirm all the things they’ve been learning about you over their past months of volunteering and reading.

Your donation page is a big opportunity to solidify a longterm relationship with your donors. Don’t waste it with a simple form.

How is a Donation Landing Page Different?

If you’re a regular reader of the Elegant Themes Blog, you’ve probably read many articles about landing pages. There’s no shortage of tutorials on effective landing pages throughout the internet either. Unfortunately, the large majority of those articles and tutorials are focused primarily on product landing pages.

While the end-result of a donation landing page is virtually the same as a product landing page (that a user gives money to an organization), the strategy you employ for a donation landing page is very different.

A product landing page is trying to sell the potential customer and convince them to make a purchase. In contrast, a donation landing page doesn’t promise any physical return. A donation landing page isn’t going to convince the potential donor about the merits of any “product.”

Instead, a donation landing page does the following:

  • It tells a story of a need which appeals to the potential donors humanity
  • It validates that need with unbiased external information
  • It gives the potential donor an easy way to donate on-page without redirect

Creating Your Donation Landing Page

Now that we understand the purpose of landing pages and our strategy for a donation landing page, let’s make it happen.

Here’s a screenshot of a basic landing page that I created with the Divi Builder:

DonationLandingPageGivePluginDev

While our content strategy for this landing page is very different than a product page, the basic principles of conversion design still apply. We still want to encapsulate the view of the visitor, create visual contrast, provide social proof, and a sense of urgency as well. These principles are fairly universal. The difference is the tone and the visual with which you present your case or story.

In my example, I open immediately with the story. I have an image that should provide an emotional response and my story explains the need clearly.

I then validate our Cause with testimonials from real donors. If your Organization is driven by particular data-points, you might choose to use those here instead of testimonials. Both serve the same purpose though of providing “social proof.”

Right before my donation form, I give a last plea that describes the urgency. If donors understand that daily donations are put to daily benefit of the cause then urgency is clear.

I’ll discuss the donation form later, but the central purpose of the donation form is to get out of the way. I say this often, but it basically means that if your form takes up half of your whole page and attracts a ton of attention, then you’re doing something wrong. Keep the donation form as simple and minimalist as possible so that it’s as easy as possible for your donors to donate. That’s the goal.

Now we just have to actually build it. This is really the fun part because the Divi Theme and Builder does all the heavy lifting for us.

Naturally, your theme is going to be configured for your site, so I won’t go into the particulars of my theme configuration. The one thing I want to highlight though is just some important aspects to keep in mind:

1. No Sidebars. You don’t want to give your donors any excuse to go navigating somewhere else. Once they land on the landing page, you want to remove all distractions. I go into detail on this idea here.

2. No sticky Menus. This is the same principle as no sidebars. You want to encourage your reader to read straight down the page to the form, so keep the navigation out of sight.

3. The Boxed layout. I know full-width layout are (still) attractive, but in this case the vertical sides (on desktop) really help encourage the eye down the page. They reinforce that there’s MORE to see down below.

All of these options are very simple to implement with the Divi Theme with just a few clicks via the Customizer.

Now to build the actual page with Divi Builder. I started by using the “Landing Page” template straight from the built-in Divi Library.

load_landing_page_template

It’s a simple but effective template that serves our purpose perfectly. It comes out-of-the-box with the Conversion Design in mind.

landing_page_template_edit-screen

With that template in place, it’s just a matter of dropping in the content then choosing and cropping powerful images and perhaps doing some basic margin and padding adjustments. Since these particulars will be different for each landing page I won’t go into the design specifics here. Instead, I’ll save the detailed instructions for the Give form below.

Using Give with the Divi Builder

It just takes four steps to get your form embedded into your new donation landing page. The first step is to install and activate Give by going to Plugins > Add New and searching “Give.”

The second step is to setup your payment gateway. Give comes with PayPal Standard for free. All it takes to configure it is to go to Donations > Settings > Payment Gateways and enter your email address in the settings field.

The third step is to go to Donations > Add Form. Once you’re there you have quite a few options, but you can literally just give your form a title and hit Publish and you’re done.

The fourth step is to go to your donation landing page and edit it via the backend. I know the front-end Divi Builder is really slick. But one thing currently missing in the frontend is the ability to inherit custom buttons to the editor that many plugins — including Give — utilize. Go into your last panel, to a Text Module, and above the editor you’ll see a button that says “Give Shortcodes.” That will allow you to insert your Give form directly into the editor.

Divi_Builder_Module_Give_Shortcode

In my case, I added another compelling image to the left of the form. It’s a good option because it also helps the form keep a good maximum width which is a cleaner look.

Hit Publish and you’re done!

Customizing Your Give Form

While the default Give options work just fine, everyone wants to tweak their forms to be exactly how they’d like. Give has plenty of options and settings for customizations. But it also inherits the Divi styles well and can be easily customized with custom CSS.

That said, the form in my example has no custom CSS at all. Here are a few things I did configured for added conversion helpfulness though:

1. Donation Goal: Donors like to know that there is a goal in mind. They want to see how much their contribution is going to help toward that goal. This subtle visual cue can mean a lot to some donors.

enable_goal_give_form

2. Multi-level suggestions: If you just provided a simple amount field, it’s possible you might just get $5 donations continually. By providing the donors with suggested amounts and some way to understand how that amount pertains to their goal you affirm and encourage their generosity.

enable_multi_level_give_form

3. Recurring Donations: This particular form supports Recurring Donations via the premium Recurring Donations Give Add-on. Many non-profits have found that allowing your donors to give on a regular basis greatly increases the total amount they give over the course of the year. This is particularly true of those on limited budgets. They’d prefer to stretch their giving out over the course of a year than one larger sum.

enable_recurring_give_form

Next Steps

Because Divi enables you to make these types of pages anywhere throughout your site, and you can embed as Give form you want into those pages, it’s very easy to do a simple one-off campaign to test how effective a landing page might be.

I’d encourage you to take this opportunity to implement a landing page for your next donation campaign or drive, and compare the results with your previous drives where you only had a simple form. I believe you’ll be very happy with the results.

The post Creating a Donation Landing Page with Divi and Give appeared first on Elegant Themes Blog.

The What, How and Why of WP-CLI: WordPress in Your Terminal

If you’ve been to a Wordcamp or two, chances are good that you’ve heard of the existence of a thing called “WP CLI.” Maybe that’s all you know. Maybe you’ve used it. Maybe you have a sinking feeling of guilt when you hear that name because you feel like you should have used it by now. Whatever the case, this article will tell you what WP-CLI is, how you get it, and why you might want to.

Around this and all other learning, don’t forget the two rules: no blame and no shame. You learn what you need when you need it, if you don’t know something you shouldn’t feel embarrassed to ask. People who don’t honor learning are jerks.

What WP-CLI Is (and Isn’t)

For those who’ve never heard of it, understanding WP-CLI starts by understanding what the letters mean. They stand for “WordPress Command Line Interface”. That means that WP-CLI is a program that allows you to use WordPress on the command line. Don’t know what the command line is? We’ve got an article explain exactly what a “terminal” is why they’re useful. The executive summary is that it’s a low-interface way to manipulate WordPress.

The next obvious question, if we understand the idea of using WordPress from the command line is “Why?” The basic reasons are as follows, in no particular order:

  1. It’s faster. A keyboard-only interface is faster for experienced users than a mouse-and-keyboard graphical interface can be.
  2. It’s automatable. As GUI-less commands are faster for experienced humans, they’re WAY easier for machines. That’s one of the big places where WP-CLI shines. It’ll take care of hundreds of installs in a jiffy if you’re good at shell scripting.
  3. It’s got weird powers. There aren’t a ton of things, but WP-CLI has some pretty neat and useful tricks. We’ll detail a few in this article. Things that WordPress itself can’t do WP-CLI can and does sometimes do for you.

Those reasons listed, there are also reasons not to use WP-CLI. Primarily: you don’t need it and it’s not helping you with things you care about. If you have a single WordPress site on a single server, there’s no need to think about WP-CLI. If you don’t know how to use the command line, don’t think or worry about WP-CLI. (But if you’re interested, here are the basics of file and non-file Unix CLI commands.) WP-CLI isn’t essential and it’s not something you should ever feel bad about. It’s a useful tool that can help you out a lot, but only if you have the specific problems that it solves well.

How to Install WP-CLI

The process of installing WP-CLI is only a few steps. And the official WP-CLI site lays them out quickly and cleanly. There’s really only one reason that you may need more than following those directions. That you need or want to know what each command you’re typing into your terminal is doing. If you’re looking for that check out our latest Quick Guide:

http://bit.ly/2jQx6n4

Cool Tricks You Can Do With WP-CLI

This isn’t an exhaustive WP-CLI tutorial. There are two reasons for that: first, such a thing is pretty silly. If you understand how to one CLI command, explaining each in detail is a waste. The other reasons is that we’ve not got time or space to really do that. The WP CLI can do so many things for you, and a lot of them aren’t used that much. So we’ll instead cover the seven uses of WP-CLI that are worth knowing about. These are things that I find WP-CLI does better than most other solutions I know of, and that I’ve used and loved before.

Quickly Update all Core Files

Keeping WordPress up-to-date is one of the easiest things you can do to keep it secure. It’s increasingly easy, but you can do it with WP-CLI too.
It’s as simple as:

wp core update

That’s great. But WP-CLI can do more. Let’s suppose that WordPress is up-to-date, but you worry that someone has tampered with the core files in your WordPress site. Maybe you think you were hacked, maybe you think you work with a dummy. Either way, you can use a similar command to put WordPress core back to a known-good state. Just run:

wp core download --force

With that, even if you don’t need an update, you’ll get your WordPress core files replaced with freshly downloaded ones from WordPress.org. Other solutions exist—you can download a zip, extract it, then upload those files—but they’re not even a third as fast. You could probably do the whole WP-CLI install and run the command in less time than the manual FTP solution would take.

There are a few other useful but subtly different commands. The clearest of these is wp core verify-checksums. This is a great little command, because it’ll just tell you immediately if the WordPress core files you have on your site been tampered with. It also tells you if there are unexpected files in the WordPress installation. But unlike the wp core download command, it doesn’t change them. This is great because it means that you can easily handle the case of wanting to do a forensic investigation if any core files have changed.

Update a Plugin or Theme from the Command Line

You can use WP-CLI to install a singe plugin. I do this often for new sites with a few plugins I use a lot. It looks like:

wp plugin install plugin-slug

Add the --activate flag to install and activate the plugin in one stroke. If you want to activate an already-installed plugin, you can do that too with a simple wp plugin activate plugin-slug.

Update all Plugins or Themes with WP-CLI

If you have confidence in the ability to safely update the plugins and themes on your site, you can simply issue two commands to get your site up-to-date:

wp plugin update --all
wp theme update --all

Which command updates plugins vs themes is so straight-forward from the command’s text that I won’t do us the unnecessary chore of detailing it. I will just say that these are some of favorite things. They were great before we had the newer update features in the WordPress dashboard, and they’re still great now. (Though I enjoy dashboard updates a lot more now.)

WP-CLI Can Dump the WordPress Database

To “export” the database is to take the data from your WordPress MySQL database and write it out to a single flat text file. That’s useful for both backup/snapshot reasons, and for the sake of being able to move a site. Of the latter more below. You do it like this:

wp db export [<file>]

This command has an optional argument of the file name. If you don’t specify one, it’ll default to the name of your database. If you specify it, it’ll write the file out to the file you name.

For data-security reasons, a real backup solution is more than doing local dumps of database files onto the server your WordPress site is running on. But this simple command is a great first step.

Easily Import into the WordPress Database using WP-CLI

As you may have guessed, an “import” is taking a flat file of database information and writing it into the live WordPress database. That way, the “imported” data starts to affect what the site looks and feels like. This is useful if you’ve done an export for data migration reasons:

wp db import [<file>]

If you’re conversant in databases, you know that a data migration in WordPress is basically a three step process: an export, an import, and a find-and-replace. Which means that we’ve covered two of the three steps. The last remaining one is…

Find-and-replace in the WordPress database with WP-CLI

wp search-replace <old> <new>

So if we moved out site from “wpshout.com” to “wpisgreat.org”, we’d do:

wp search-replace wpshout.com wpisgreat.org

With the export, the import, and then the replace command our site would be back up in running at the new URL in seconds. You may need to use rsync or a similar command to push the exported file to the server it should be imported on. See [our recent article about how that command works]
(http://bit.ly/2kLLhsa) if you’re looking to that.

Using WP-CLI to Regenerate Thumbnails

One the most common tasks a WordPress developer need to do when redesigning a WordPress site is regenerate the images for the new featured image size on their new theme. This doesn’t always happen, but it does a lot in my experience. If you don’t know the command line, you probably use the great little Regenerate Thumbnails plugin for this. You can easily accomplish this with WP-CLI though. All you need is the little command:

wp media regenerate

This will do exactly what the plugin does for you. It give you less useful output, but in my experience it also accomplishes the task a good deal faster. The command also has some interesting and useful options:

  • <attachment-id> — If you have one specific image that you’re having issues with, you can constrain the command to working on that ID, or IDs.
  • --skip-delete — This option stops the command from deleting images of different sizes that may no longer be registered on the site. For most WordPress sites it’s unnecessary, but if you want old hotlinks to your images to still work, you may want to include this argument.
  • --only-missing — This option making the command only generate thumbnails of sizes that are missing. This especially useful on large sites where you’re just needing to get a new size of image.

We’re Just Scratching the Surface of WP’s CLI

With WP-CLI, you can manage transients and the object cache, run single PHP files after you’ve loaded WordPress, quickly scaffold out a testing infrastructure, and a whole lot more. This is list is just the things that came to mind that I use regularly when administering and developing WordPress sites.

In all cases, --help is a great place to start. wp --help gives you a listing of all the things that the wp command can do. And if you’re interested in specific subset of features, wp plugin --help or similar gives you a deeper dive on that little set of features. Getting comfortable using your terminal to read those documents

Why You Need WP-CLI in Your Life

WP-CLI is just a great tool for people who need to do small little administrations tasks on a WordPress site on a regular basis. It has powers far beyond what we’ve seen. But quickly bringing a WordPress site up-to-date in a few CLI commands is so much faster than going through the interface that most developers quickly learn to love WP-CLI. It’s not the cure-all for your WordPress problems, but it helps with so many tasks a developer need to do on a site that it’s essential to be familiar with it.

How to Display WordPress Photos in Columns and Rows

Do you want to display WordPress photos in columns and rows? By default WordPress adds images in a vertical column on top of each other. However if you are adding multiple photos to a blog post, then this doesn’t look very clean and requires a lot of scrolling for your users. In this article, we will show you how to easily display WordPress photos in columns and rows.

Display WordPress photos in rows and columns

Why You Need WordPress Photos in Columns and Rows

By default, when you add multiple images to a WordPress post, they would appear right next to each other or on top of each other.

default scrolling display of photos in WordPress

This doesn’t look very good, and your users will have to scroll a lot to view multiple images and photos.

You can easily solve this problem by displaying photos in rows and columns using a grid-based layout. This way images will appear in a compact layout and improve user experience on your website.

photos in columns and rows

Having said that, let’s take a look at how to display WordPress photos in columns and rows.

1. Display Photos in Columns and Rows without Plugins

This method does not require you to install any new plugin on your website. If you don’t add multiple photos too often, then this would work just fine for you.

First, you need to create a new post or edit an existing one where you want to display your photos. On the post edit screen, click on the ‘Add Media’ button to launch the WordPress media uploader popup.

Click on add media button to upload your photos in WordPress

Next, you need to upload all the photos you want to display in rows and columns. After the upload, you will see your photos in the media library.

Create gallery in WordPress

The images you just uploaded will already be selected. If you want to include any previously uploaded photos, then you can select them as well by just clicking on them in media library.

After that you need to click on ‘Create Gallery’ link from the left column and then click on ‘Create a new gallery’ button.

Click to create a new gallery of selected photos

The popup window will now change to show gallery settings options.

You can select number of columns, where each image should link to, what size of image to show, and randomize display order.

Gallery settings option

After that you need to click on the insert gallery button and WordPress will insert the gallery in your blog post.

Photos in columns and rows as a gallery in WordPress

If you want to change the number of columns or other settings, then you just need to click on the photos in post editor.

WordPress will select your gallery and you can then click on the pencil icon to edit your gallery settings.

Edit gallery settings

That’s all, you can continue writing your post or save your changes. You can preview the post now to see your photos in rows and columns.

Photos in rows and column layout in WordPress

This method would work for most beginners. However, if you run a photography blog or often share photos on your website, then this method lacks several important features.

For example, the appearance of photos relies on your WordPress theme and you are limited to that one particular layout and style.

Your images will not open in a lightbox popup and users will have to load them as a new page and then hit the back button to return to the original page.

For a more professional and beautiful user experience you should try the plugin method.

2. Display Photos in Columns and Rows Using Plugin

First thing you need to do is install and activate the Envira Gallery plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Envira Gallery is one of our premium WordPress plugins and pricing starts from $19 for a single site license.

Upon activation, you need to visit Envira Gallery » Settings page to enter your license key. You can get this key from your account on Envira Gallery website.

Enter Envira Gallery license key

Now you are ready to create beautiful image galleries.

Head over to Envira Gallery » Add New page to create your first gallery.

Upload photos to create new gallery

You can select and upload files from your computer, or you can select from WordPress media library.

After uploading your photos, they will appear in the gallery settings box below.

Photos added to Envira Gallery

Next, you need to click on the config tab to customize how you want to display your photos.

Under ‘Number of Gallery Columns’, you can select the number of columns for your photos.

Configure number of columns for your photos

You can also specify the exact size of thumbnails you want to display, and the how much spacing you want between images in columns.

After that you can click on the publish button to make your photo gallery ready to be added into your WordPress site.

Now you need to edit a post or create a new one. You will notice the new ‘Add Gallery’ button on top of post editor.

Add gallery button

Clicking on it will bring up a popup where you need to select the gallery you just created and click on the insert button.

Insert gallery

The plugin will now add the gallery shortcode into post editor.

You can save your post and preview it to see your photos in columns and rows in a beautiful mobile-responsive photo gallery.

Photo columns in Envira Gallery

Now when your users click on a photo thumbnail it will open up in a beautiful popup. They will also be able to browse images without leaving the page.

Browsing photos in a post

We hope this article helped you learn how to display WordPress photos in columns and rows. You may also want to see our guide on how to fix common image issues in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Display WordPress Photos in Columns and Rows appeared first on WPBeginner.

Yoast SEO 4.2 adds another new language: Dutch

In our quest to speak more of the world’s languages, we’ve now added our mother tongue: Yoast SEO 4.2 premium supports Dutch in its entirety. Our Dutch writing audience can now use all of our innovative features, like Insights and Internal linking suggestions, in their own language. More languages will follow soon.

Optimize your site for search & social media and keep it optimized with Yoast SEO Premium »

Yoast SEO for WordPress pluginBuy now » Info

Insights into more languages

As you might know, the release of Yoast SEO 4.0 saw the introduction of our new Internal linking feature. At that time, this revolutionary tool that helps you build an effective site structure quickly was only available in the English language. Just a couple of weeks ago, we added support for the language of our neighbors to the east: German. Now it’s time for Dutch, the language we know so well.

The text analysis tools of Yoast SEO checks the content of your posts and pages. It actively gives you advice on what to improve. The readability analysis gives you an idea how readable your post is for a regular person. Following the green bullet paradigm, you can see directly if your text is too hard to read. Or if it is littered with passive voice or uses too many words in a paragraph.

To give you correct insights into your writings, we need to fully understand a language. This process takes time, and we’re slowly, but surely adding new languages. After Dutch in Yoast SEO 4.2 premium, it is time to work on support for prominent words and link suggestions in Spanish. Looking past that, we’d like to add support for French.

If you’d like to read up on how we developed the internal linking suggestions tool and the big part language plays, we’d like to recommend this post by our linguist Irene. You can read more about the philosophy behind it in this post by our CTO Omar.

What else is new

Besides adding a new language, we’ve fixed a couple of bugs and made some necessary enhancements. We’ve moved the translations from translate.yoast.com to translate.wordpress.org. To tighten things up, we’ve made sure the settings page and left sidebar are more responsive, so they should accurately scale. In addition to that, we’ve cleaned up the meta box a little and enhanced the styling of the featured image warning screen.

As always, we hope you enjoy this new release. If you need more information, please find the complete changelog on wordpress.org.

Read more: ‘Why you should use Yoast internal linking’ »