How to Find Which Files to Edit in WordPress Theme

Recently, one of our readers asked how do you find which files to edit in their WordPress theme? If you are new to WordPress theme development and want to customize your theme, then you need to learn which template files in your theme you need… Read More »

The post How to Find Which Files to Edit in WordPress Theme appeared first on WPBeginner.

Recently, one of our readers asked how do you find which files to edit in their WordPress theme? If you are new to WordPress theme development and want to customize your theme, then you need to learn which template files in your theme you need to edit. In this article, we will show you how to easily find which files to edit in WordPress theme.

How to find which WordPress theme files to edit

Template Files in WordPress Themes

WordPress themes control how your website looks to your users. Each theme contains several template files which control the appearance of a particular section or page in your WordPress theme.

For example, single.php file controls the appearance of single posts on your website. It is not the only file to do that.

If your theme does not have a single.php file, then WordPress will look for alternate templates like index.php to display the page.

Most beginners are not familiar with template hierarchy in WordPress. This makes it harder for them to figure out which files to edit when they want to customize their themes.

Having said that, let’s see how to easily find out which files to edit in your WordPress theme.

Finding Template Files in WordPress Themes

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

The plugin works out of the box, and there are no settings for you to configure.

Upon activation, you need to visit your website and you will notice a new ‘What the file’ menu in WordPress admin bar.

What the file menu in WordPress admin bar

Now you need to just take your mouse over to the menu item, and it will display a drop down menu listing the template files used to display this page.

Template files used to display this page

Clicking on the file name will take you to the default WordPress file editor where you can edit that particular file.

However, we do not recommend using WordPress file editor to edit theme files because there is no undo option. If you accidentally lock yourself out of your website, then you would have to use a FTP client. That’s why we always using a FTP client and plain text editor to edit your files.

Making direct changes to your WordPress theme is also a bad idea. Those changes will disappear when you update your theme.

If you are just adding some CSS, then you can add it as custom CSS in WordPress. For all other changes you should create a child theme.

‘What The File plugin’ can help you locate the theme files that you need to copy and edit in your child theme.

Note: The menu item added by the plugin in the admin bar will be visible to all logged in users, and it has a link to an external site. You should only use this plugin in development environment.

We hope this article helped you learn how to find which files to edit in WordPress themes. You may also want to see our guide on how to test your WordPress theme against latest standards

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 Find Which Files to Edit in WordPress Theme appeared first on WPBeginner.

How to Choose the Best Domain Name (8 Tips and Tools)

Picking the right domain name for a blog is an essential step to success. Think of a domain name as a brand to your website, and like any other product, a blog will be really hard to rebrand if you decide to choose another name. With that in mind, pick what you think is the best using the tips, and domain tools we provide in this article.

The post How to Choose the Best Domain Name (8 Tips and Tools) appeared first on WPBeginner.

Choosing the right domain name for your website is crucial for your success. If you choose the wrong domain name, then it can be a hassle switch later on without hurting your brand and search rankings. That’s why it’s extremely important that you choose the best domain name from the start. In this article, we’ll share all the tools and tips you need to get domain name ideas, choose the best domain name, and register your new domain (for free*).

How to Choose the Best Domain Name

8 Tips for Choosing the Best Domain Name

When starting a blog, choosing a domain name can be stressful because you don’t want to make a mistake. To make the process easier, we have a 8 step framework that you can use to pick the best domain for your website.

1. Stick with .com

There are plenty of new domain name extensions available today, from the original .com, .net and .org to niche extensions like .pizza, .photography, and even .blog.

We always recommend choosing a .com domain. While it can be tempting to come up with clever blog names using new extensions, a .com domain is still the most established and credible domain extension. Newer domain extensions like .ninja or .photography can be untrustworthy.

Dot-com domains are also the most memorable. Many users, especially those who aren’t as tech-savvy, will automatically type “.com” on the end of every domain without thinking about it.

If your website is something like jane.photography, and your users accidentally type in jane.photography.com, they will end up on an error page on photography.com. It’s smart to avoid that risk by sticking with .com.

Not to mention, most smart phone keyboards automatically have a .com button.

2. Use keywords

Keywords play an important role in a domain. By using keywords in your domain name, you tell the search engines what your website is about. Together with quality content and good user experience, keywords in your domain can help you rank higher in Google.

It is very hard to find a good domain with your target keywords that’s not already taken. You will need to be creative and combine your keywords with other words to make your domain stand out.

3. Keep it short

While keywords are important, don’t go overboard with domain length. It’s better to have a domain name that’s short and memorable.

It’s a good idea to keep your domain name under 15 characters. Longer domains are harder for your users to remember.

Not to mention, users will also be more prone to entering typos with longer domain names, and you’ll lose out on that traffic.

That’s why it’s a good idea to keep your domain length short.

4. Make it easy to pronounce and spell

You should be able to easily share your domain when speaking as well as writing. You never know when you’ll be asked to share your domain name in person.

It should be easy to understand and spell for any listener.

5. Keep it unique and brandable

Your blog domain name must be unique, so you’ll stand out in your readers’ minds. It’s smart to research other blogs in your niche and find out what domain names they’re using.

You don’t want to accidentally use a trademarked name, or get accused of copying another blogger.

You can also choose to pick a domain name that’s more brandable. Brandable domain names are unique, catchy, and memorable. For example, “Amazon.com” is a much more brandable name than “BuyBooksOnline.com.”

6. Avoid hyphens

Never create a domain name with hyphens. Hyphens can be a sign of spam domains, which you do not want to be associated with. You don’t want to give the wrong impression to potential visitors.

Hyphenated domains are also prone to typos. If you choose a domain name with hyphens because the domain you want is already taken, your users will end up at your competitor’s site if they forget to type in the hyphens.

7. Avoid doubled letters

It’s a good idea to avoid domains with doubled letters, because it increases your chances of losing traffic to typos. For example, a domain like WordPresssetup.com will be more prone to typos, and result in lost traffic.

8. Leave room to expand

It’s smart to choose a domain name that’s related to your niche because it gives users some idea of what your site is about. But you don’t want to limit your options too much.

For example, a florist might choose a domain name like orchidblog.com, but then want to start blogging about other flowers besides orchids. In that case, the domain might prevent you from attracting readers interested in other flowers.

Properly moving your WordPress site to a new domain can be a frustrating process, and it can cause you to lose search rankings and traffic if you don’t do it right.

That’s why it’s so important to keep these tips in mind, so you can choose the best domain name for your website.

Best Place to Register a Domain Name

There are hundreds of domain registrars on the web. It’s important to choose carefully, because it can be difficult to move your domain later on.

Just like with web hosting, pricing for domain registrations can vary anywhere from $9 to $24.

Here are a few places we recommend for domain registrations.

Free Domain Registration with Web Hosting

Majority of web hosting companies also offer domain registration. Some of those companies offer free domain registration with new hosting accounts.

If you’re starting a new blog or website, then it’s a smart idea to take advantage of this offer and get your domain name for free.

Below are three WordPress hosting companies that are offering our users over 60% off web hosting and a free domain name:

Bluehost – one of the oldest and largest brand name when it comes to web hosting. They’re an official “WordPress” recommended hosting provider.

SiteGround – one of the most popular and highest rated hosting provider in the industry. They’re also an official “WordPress” recommended hosting provider.

iPage – powers over 1 million websites and is the most budget-friendly web hosting provider on the web. $1.99 / month for web hosting and you get a free domain name.

It’s important to keep in mind that most hosts offer free domain registrations for 1 year only. After the first year, your domain registration will renew at usually around $14 per year.

A lot of users take advantage of the free domain for the first year and then transfer it to a cheaper domain registrar to save a few bucks.

Most Popular Domain Registrars

GoDaddy is the largest domain registrar in the world. They manage over 63 million domain names for over 14 million customers.

They also offer web hosting plans as well. If you use our GoDaddy coupon code, then you can get a free domain name.

NameCheap – another popular domain registrar that offers great deals on domain registrars, transfers, and domain privacy.

Final Thoughts

If you are starting a blog for the first time, then you may find our ultimate guide on how to start a WordPress blog helpful because it walks you through everything step by step.

You may also want to check out our WordPress and Blogging Coupons page to find the best deal on your new domain and other web tools / services.

For more domain name ideas, you can see our post on the 14 best free domain name generators.

That’s all. We hope this article helped you understand how to choose a perfect domain name for your blog or business.

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 Choose the Best Domain Name (8 Tips and Tools) appeared first on WPBeginner.

How to Choose the Best Domain Name (8 Tips and Tools)

Picking the right domain name for a blog is an essential step to success. Think of a domain name as a brand to your website, and like any other product, a blog will be really hard to rebrand if you decide to choose another name. With that in mind, pick what you think is the best using the tips, and domain tools we provide in this article.

The post How to Choose the Best Domain Name (8 Tips and Tools) appeared first on WPBeginner.

Choosing the right domain name for your website is crucial for your success. If you choose the wrong domain name, then it can be a hassle switch later on without hurting your brand and search rankings. That’s why it’s extremely important that you choose the best domain name from the start. In this article, we’ll share all the tools and tips you need to get domain name ideas, choose the best domain name, and register your new domain (for free*).

How to Choose the Best Domain Name

8 Tips for Choosing the Best Domain Name

When starting a blog, choosing a domain name can be stressful because you don’t want to make a mistake. To make the process easier, we have a 8 step framework that you can use to pick the best domain for your website.

1. Stick with .com

There are plenty of new domain name extensions available today, from the original .com, .net and .org to niche extensions like .pizza, .photography, and even .blog.

We always recommend choosing a .com domain. While it can be tempting to come up with clever blog names using new extensions, a .com domain is still the most established and credible domain extension. Newer domain extensions like .ninja or .photography can be untrustworthy.

Dot-com domains are also the most memorable. Many users, especially those who aren’t as tech-savvy, will automatically type “.com” on the end of every domain without thinking about it.

If your website is something like jane.photography, and your users accidentally type in jane.photography.com, they will end up on an error page on photography.com. It’s smart to avoid that risk by sticking with .com.

Not to mention, most smart phone keyboards automatically have a .com button.

2. Use keywords

Keywords play an important role in a domain. By using keywords in your domain name, you tell the search engines what your website is about. Together with quality content and good user experience, keywords in your domain can help you rank higher in Google.

It is very hard to find a good domain with your target keywords that’s not already taken. You will need to be creative and combine your keywords with other words to make your domain stand out.

3. Keep it short

While keywords are important, don’t go overboard with domain length. It’s better to have a domain name that’s short and memorable.

It’s a good idea to keep your domain name under 15 characters. Longer domains are harder for your users to remember.

Not to mention, users will also be more prone to entering typos with longer domain names, and you’ll lose out on that traffic.

That’s why it’s a good idea to keep your domain length short.

4. Make it easy to pronounce and spell

You should be able to easily share your domain when speaking as well as writing. You never know when you’ll be asked to share your domain name in person.

It should be easy to understand and spell for any listener.

5. Keep it unique and brandable

Your blog domain name must be unique, so you’ll stand out in your readers’ minds. It’s smart to research other blogs in your niche and find out what domain names they’re using.

You don’t want to accidentally use a trademarked name, or get accused of copying another blogger.

You can also choose to pick a domain name that’s more brandable. Brandable domain names are unique, catchy, and memorable. For example, “Amazon.com” is a much more brandable name than “BuyBooksOnline.com.”

6. Avoid hyphens

Never create a domain name with hyphens. Hyphens can be a sign of spam domains, which you do not want to be associated with. You don’t want to give the wrong impression to potential visitors.

Hyphenated domains are also prone to typos. If you choose a domain name with hyphens because the domain you want is already taken, your users will end up at your competitor’s site if they forget to type in the hyphens.

7. Avoid doubled letters

It’s a good idea to avoid domains with doubled letters, because it increases your chances of losing traffic to typos. For example, a domain like WordPresssetup.com will be more prone to typos, and result in lost traffic.

8. Leave room to expand

It’s smart to choose a domain name that’s related to your niche because it gives users some idea of what your site is about. But you don’t want to limit your options too much.

For example, a florist might choose a domain name like orchidblog.com, but then want to start blogging about other flowers besides orchids. In that case, the domain might prevent you from attracting readers interested in other flowers.

Properly moving your WordPress site to a new domain can be a frustrating process, and it can cause you to lose search rankings and traffic if you don’t do it right.

That’s why it’s so important to keep these tips in mind, so you can choose the best domain name for your website.

Best Place to Register a Domain Name

There are hundreds of domain registrars on the web. It’s important to choose carefully, because it can be difficult to move your domain later on.

Just like with web hosting, pricing for domain registrations can vary anywhere from $9 to $24.

Here are a few places we recommend for domain registrations.

Free Domain Registration with Web Hosting

Majority of web hosting companies also offer domain registration. Some of those companies offer free domain registration with new hosting accounts.

If you’re starting a new blog or website, then it’s a smart idea to take advantage of this offer and get your domain name for free.

Below are three WordPress hosting companies that are offering our users over 60% off web hosting and a free domain name:

Bluehost – one of the oldest and largest brand name when it comes to web hosting. They’re an official “WordPress” recommended hosting provider.

SiteGround – one of the most popular and highest rated hosting provider in the industry. They’re also an official “WordPress” recommended hosting provider.

iPage – powers over 1 million websites and is the most budget-friendly web hosting provider on the web. $1.99 / month for web hosting and you get a free domain name.

It’s important to keep in mind that most hosts offer free domain registrations for 1 year only. After the first year, your domain registration will renew at usually around $14 per year.

A lot of users take advantage of the free domain for the first year and then transfer it to a cheaper domain registrar to save a few bucks.

Most Popular Domain Registrars

GoDaddy is the largest domain registrar in the world. They manage over 63 million domain names for over 14 million customers.

They also offer web hosting plans as well. If you use our GoDaddy coupon code, then you can get a free domain name.

NameCheap – another popular domain registrar that offers great deals on domain registrars, transfers, and domain privacy.

Final Thoughts

If you are starting a blog for the first time, then you may find our ultimate guide on how to start a WordPress blog helpful because it walks you through everything step by step.

You may also want to check out our WordPress and Blogging Coupons page to find the best deal on your new domain and other web tools / services.

For more domain name ideas, you can see our post on the 14 best free domain name generators.

That’s all. We hope this article helped you understand how to choose a perfect domain name for your blog or business.

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 Choose the Best Domain Name (8 Tips and Tools) appeared first on WPBeginner.

How to Accept Payments with Stripe in WordPress

Do you want to accept payments with Stripe in WordPress? Stripe makes it easier for site owners to accept payments on their WordPress websites. In this article, we will show you how to easily accept payments with Stripe in WordPress. Note: Stripe requires your site… Read More »

The post How to Accept Payments with Stripe in WordPress appeared first on WPBeginner.

Do you want to accept payments with Stripe in WordPress? Stripe makes it easier for site owners to accept payments on their WordPress websites. In this article, we will show you how to easily accept payments with Stripe in WordPress.

How to accept payments with Stripe in WordPress

Note: Stripe requires your site to be using SSL/HTTPS encryption. If you don’t already have SSL certificate for your website, then please see our step by step guide on how to add SSL in WordPress. Some WordPress hosting providers are now offering free SSL with Let’s Encrypt.

There are many different ways to accept payments with Stripe in WordPress. We will cover 4 different methods, so you can choose the one that best suit your needs.

For quick browsing, feel free to use the navigation links below:

Custom Stripe Order Forms in WordPress with WPForms

WPForms is the best WordPress form plugin. It allows you to create custom payment forms and easily accept payments on your WordPress site using Stripe and PayPal.

WPForms is a paid plugin, and you will need the Pro plan to use the Stripe and PayPal addons.

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

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

Adding your WPForms license key

After verification, you need to head over to WPForms » Addons page.

Scroll down to ‘Stripe Addon’ and click on the Install Addon button next to it.

WPForms will automatically install the Stripe forms addon. You will need to click on the activate button to start using this addon.

Next, you need to visit WPForms » Settings page and click on the payments tab.

Once there, you need to connect Stripe to your WordPress site by entering the API keys. You can get these keys from your Stripe account settings.

Payment settings

After entering the API keys don’t forget to click on the save button to store your settings.

You are now ready to accept payments using Stripe in WordPress.

Next, you need to create a form to accept payments on your WordPress site.

Head over to WPForms » Add New page. This will launch the WPForms form builder interface.

Select a form template

WPForms comes with ready to use form templates. You can select an Order/Billing form, donations form, or create a blank form.

WPForms edit fields

You can add new form fields by clicking them from the left column. You can also edit a form field by simply clicking on it.

Once you are satisfied with the form, you need to click on the Payments » Stripe tab.

Adding payment form settings

Now you need to check the box next to ‘Enable Stripe payments’ option and enter a description for the payment. You can also select to send a payment receipt.

Don’t forget to click on the save button to store your settings.

You are now ready to add this form to any WordPress post or page you want.

Simply create a new post or page or edit an existing one and then click on the Add Form button.

Add payment form to a WordPress post or page

This will bring up a popup where you need to select the form you just created and click on the add form button.

Select your Stripe payment form

WPForms will now add the form shortcode to your WordPress post editor.

You can now save or publish your page and click on the preview button to see your form in action.

Stripe payment form

Purchase Button with WP Simple Pay Lite for Stripe

This method allows you to add a payment button to your WordPress site. Unlike WPForms, this method does not allow you to create custom payment forms with your own fields.

First thing you need to do is install and activate the WP Simple Pay Lite for Stripe plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, the plugin will add a new menu item labeled ‘Simple Pay Lite’ to your WordPress admin bar. Clicking on it will take you to plugin’s settings page.

Simple pay lite settings

The first option you will notice on the settings page is live mode. By default, it is turned off. This allows you to add Stripe in testing mode. Once you are ready to go live, you will need to turn it on.

Next you will need to provide your Stripe API Keys. You can get this information from your Stripe account.

After entering your API Keys don’t forget to click on the save changes button to store your settings.

Next, you need to click on the default settings tab on plugin’s settings page.

Default settings for WP Simple Pay Lite

This is where you can set site name, currency, logo, payment button label, etc.

You can also add redirect URLs when a payment is successful or failed. These could be any WordPress pages on your site.

Don’t forget to click on the save changes button to store your settings.

Now you are ready to add a Stripe payment form to your website.

Simply create a new page or edit a page where you want to display the payment form. You will need to add a shortcode to display your Stripe payment form, like this:

[stripe name="My Store" description="My Product" amount="19.99"]

Don’t forget to replace store name, description, and amount with your own values.

You can now save your changes and visit your website to see the form in action.

Stripe payment form in WordPress using WP Simple Pay Lite

Adding Stripe Payment Gateway in WooCommerce

If you are running an online store with WordPress using WooCommerce, then here is how you can accept payments using Stripe.

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

Upon activation, you need to visit WooCommerce » Settings page and then click on the checkout tab.

You will notice the new Stripe payment option on the page. Clicking on it will allow you to setup Stripe payment gateway for your WooCommerce store.

Setting up Stripe on WooCommerce

First you need to click on the ‘Enable Stripe’ option.

After that you can check the test mode button, which allow you to test Stripe payment gateway. Make sure that you uncheck this box when you are ready to accept payments.

Next you need to enter your Stripe API keys. You can obtain these keys from your Stripe account settings.

Don’t forget to click on the save changes button store your settings.

That’s all, your users will now see Stripe as a payment option on the checkout page.

Stripe checkout in WooCommerce

Stripe Payments with Easy Digital Downloads

Easy Digital Downloads is one of the best WordPress eCommerce plugins on the market. It allows you to easily sell digital downloads from your WordPress site.

First thing you need to do is install and activate the Stripe Payment Gateway addon for Easy Digital Downloads. For more details, see our step by step guide on how to install a WordPress plugin.

The Stripe extension is a paid addon for Easy Digital Downloads. It costs $89 for a single site license.

Upon activation, you need to visit Downloads » Settings page and then click on ‘Payment Gateways’ tab.

Check the box next to Stripe to enable Stripe as a payment gateway on your website.

Enable Stripe on EDD

Click on the save changes button to store your settings.

Next, you need to scroll down to Stripe settings section and enter your Stripe API keys. You can get these keys from your Stripe account settings.

Adding Stripe API Keys

After adding your Stripe API keys, you can configure additional settings. You can ask users for a billing address, display checkout in a modal, upload a logo for the modal, etc.

Don’t forget to click on the save changes button to store your changes.

That’s all, your users will now see the option to pay using Stripe at checkout.

Stripe checkout Easy Digital Downloads

We hope this article helped you learn how to accept payments with Stripe in WordPress. You may also want to see our list of 24 must have WordPress plugins for business websites.

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 Accept Payments with Stripe in WordPress appeared first on WPBeginner.

Exploring the Tessel 2 IoT and robotics development board

13841-01I’m still on vacation and still on the mend from surgery. I’m continuing to play around with IoT devices on my staycation. Last week I looked at these devices:

Today I’m messing with the Tessel 2. You can buy it from SparkFun for the next few weeks for US$40. The  Tessel is pretty cool as a tiny device because it includes WiFi on the board as well as two USB ports AND on-board Ethernet. It includes a two custom “module” ports where you can pop in 10-pin modules like Accelerometers, Climate sensors, IR and more. There’s also community-created Tessel modules for things like Color Sensing and Motion.

Tessel is programmable in JavaScript and runs Node. Here’s the tech specs:

  • 580MHz Mediatek MT7620n
  • Linux built on OpenWRT
  • 802.11bgn WiFi
  • WEP, WPA, WPA2-PSK, WPA2-Enterprise
  • 64MB DDR2 RAM
  • 32MB Flash
  • 16 pins GPIO, 7 of which support analog in
  • 2 USB 2.0 ports with per-port power switching

Tessel isn’t a company, it’s a open source project! They are on Twitter at @tesselproject and on GitHub here https://github.com/tessel.

NOTE: Some users – including me – have had issues with some Windows machines not recognizing the Tessel 2 over USB. I spent some time exploring this thread on their support site and had to update its firmware but I haven’t had issues since.

Once you’ve plugged your Tessel in, you talk to it with their node based “t2” command line:

>t2 list
INFO Searching for nearby Tessels...
USB Tessel-02A3226BCFA3
LAN Tessel-02A3226BCFA3

It’s built on OpenWRT and you can even SSH into it if you want. I haven’t needed to though as I just want to write JavaScript and push  projects to it. It’s nice to know that you CAN get to the low-level stuff I you need to, though.

For example, here’s a basic “blink an LED” bit of code:

// Import the interface to Tessel hardware
var tessel = require('tessel');
// Turn one of the LEDs on to start.
tessel.led[2].on();
// Blink!
setInterval(function () {
  tessel.led[2].toggle();
  tessel.led[3].toggle();
}, 600);
console.log("I'm blinking! (Press CTRL + C to stop)");

The programming model is very familiar, and they’ve abstracted away the complexities of most of the hardware. Here’s a GPS example:

var tessel = require('tessel');
var gpsLib = require('gps-a2235h');

var gps = gpsLib.use(tessel.port['A']);

// Wait until the module is connected
gps.on('ready', function () {
console.log('GPS module powered and ready. Waiting for satellites...');
// Emit coordinates when we get a coordinate fix
gps.on('coordinates', function (coords) {
console.log('Lat:', coords.lat, '\tLon:', coords.lon, '\tTimestamp:', coords.timestamp);
});

// Emit altitude when we get an altitude fix
gps.on('altitude', function (alt) {
console.log('Got an altitude of', alt.alt, 'meters (timestamp: ' + alt.timestamp + ')');
});

// Emitted when we have information about a fix on satellites
gps.on('fix', function (data) {
console.log(data.numSat, 'fixed.');
});

gps.on('dropped', function(){
// we dropped the gps signal
console.log("gps signal dropped");
});
});

gps.on('error', function(err){
console.log("got this error", err);
});

Of course, since it’s using node and it has great Wifi or wired, the Tessel can also be a web server! Here we return the image from a USB camera.

var av = require('tessel-av');
var os = require('os');
var http = require('http');
var port = 8000;
var camera = new av.Camera();

http.createServer((request, response) => {
response.writeHead(200, { 'Content-Type': 'image/jpg' });

camera.capture().pipe(response);

}).listen(port, () => console.log(`http://${os.hostname()}.local:${port}`));

I’ll make a Hello World webserver:

var tessel = require('tessel');
var http = require('http');
var server = http.createServer(function (request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end("Hello from Tessel!\n");
});
server.listen(8080);
console.log("Server running at http://192.168.1.101:8080/");

Then push the code to the Tessel like this:

>t2 push index.js
INFO Looking for your Tessel...
INFO Connected to Tessel-02A3226BCFA3.
INFO Building project.
INFO Writing project to Flash on Tessel-02A3226BCFA3 (3.072 kB)...
INFO Deployed.
INFO Your Tessel may now be untethered.
INFO The application will run whenever Tessel boots up.
INFO To remove this application, use "t2 erase".
INFO Running index.js...

Where is my Tessel on my network?

>t2 wifi
INFO Looking for your Tessel...
INFO Connected to Tessel-02A3226BCFA3.
INFO Connected to "HANSELMAN"
INFO IP Address: 192.168.0.147
INFO Signal Strength: (33/70)
INFO Bitrate: 29mbps

Now I’ll hit the webserver and there it is!

image

There’s a lot of cool community work happening around Tessel.  You can get involved with the Tessel community if you’re interested:

  • Join us on Slack — Collaboration and real time discussions (Recommended! – ask your questions here).
  • Tessel Forums — General discussion and support by the Tessel community.
  • tessel.hackster.io — Community-submitted projects made with Tessel.
  • tessel.io/community — Join a Tessel meetup near you! Meetups happen around the world and are the easiest way to play with hardware in person.
  • #tessel on Freenode — IRC channel for development questions and live help.
  • Stack Overflow — Technical questions about using Tessel

Sponsor: Big thanks to Telerik! They recently published a comprehensive whitepaper on The State of C#, discussing the history of C#, what’s new in C# 7 and whether C# is the top tech to know. Check it out!


© 2016 Scott Hanselman. All rights reserved.
     

13841-01I'm still on vacation and still on the mend from surgery. I'm continuing to play around with IoT devices on my staycation. Last week I looked at these devices:

Today I'm messing with the Tessel 2. You can buy it from SparkFun for the next few weeks for US$40. The  Tessel is pretty cool as a tiny device because it includes WiFi on the board as well as two USB ports AND on-board Ethernet. It includes a two custom "module" ports where you can pop in 10-pin modules like Accelerometers, Climate sensors, IR and more. There's also community-created Tessel modules for things like Color Sensing and Motion.

Tessel is programmable in JavaScript and runs Node. Here's the tech specs:

  • 580MHz Mediatek MT7620n
  • Linux built on OpenWRT
  • 802.11bgn WiFi
  • WEP, WPA, WPA2-PSK, WPA2-Enterprise
  • 64MB DDR2 RAM
  • 32MB Flash
  • 16 pins GPIO, 7 of which support analog in
  • 2 USB 2.0 ports with per-port power switching

Tessel isn't a company, it's a open source project! They are on Twitter at @tesselproject and on GitHub here https://github.com/tessel.

NOTE: Some users - including me - have had issues with some Windows machines not recognizing the Tessel 2 over USB. I spent some time exploring this thread on their support site and had to update its firmware but I haven't had issues since.

Once you've plugged your Tessel in, you talk to it with their node based "t2" command line:

>t2 list

INFO Searching for nearby Tessels...
USB Tessel-02A3226BCFA3
LAN Tessel-02A3226BCFA3

It's built on OpenWRT and you can even SSH into it if you want. I haven't needed to though as I just want to write JavaScript and push  projects to it. It's nice to know that you CAN get to the low-level stuff I you need to, though.

For example, here's a basic "blink an LED" bit of code:

// Import the interface to Tessel hardware
var tessel = require('tessel');
// Turn one of the LEDs on to start.
tessel.led[2].on();
// Blink!
setInterval(function () {
  tessel.led[2].toggle();
  tessel.led[3].toggle();
}, 600);
console.log("I'm blinking! (Press CTRL + C to stop)");

The programming model is very familiar, and they've abstracted away the complexities of most of the hardware. Here's a GPS example:

var tessel = require('tessel');

var gpsLib = require('gps-a2235h');

var gps = gpsLib.use(tessel.port['A']);

// Wait until the module is connected
gps.on('ready', function () {
console.log('GPS module powered and ready. Waiting for satellites...');
// Emit coordinates when we get a coordinate fix
gps.on('coordinates', function (coords) {
console.log('Lat:', coords.lat, '\tLon:', coords.lon, '\tTimestamp:', coords.timestamp);
});

// Emit altitude when we get an altitude fix
gps.on('altitude', function (alt) {
console.log('Got an altitude of', alt.alt, 'meters (timestamp: ' + alt.timestamp + ')');
});

// Emitted when we have information about a fix on satellites
gps.on('fix', function (data) {
console.log(data.numSat, 'fixed.');
});

gps.on('dropped', function(){
// we dropped the gps signal
console.log("gps signal dropped");
});
});

gps.on('error', function(err){
console.log("got this error", err);
});

Of course, since it's using node and it has great Wifi or wired, the Tessel can also be a web server! Here we return the image from a USB camera.

var av = require('tessel-av');

var os = require('os');
var http = require('http');
var port = 8000;
var camera = new av.Camera();

http.createServer((request, response) => {
response.writeHead(200, { 'Content-Type': 'image/jpg' });

camera.capture().pipe(response);

}).listen(port, () => console.log(`http://${os.hostname()}.local:${port}`));

I'll make a Hello World webserver:

var tessel = require('tessel');
var http = require('http');
var server = http.createServer(function (request, response) {
  response.writeHead(200, {"Content-Type": "text/plain"});
  response.end("Hello from Tessel!\n");
});
server.listen(8080);
console.log("Server running at http://192.168.1.101:8080/");

Then push the code to the Tessel like this:

>t2 push index.js

INFO Looking for your Tessel...
INFO Connected to Tessel-02A3226BCFA3.
INFO Building project.
INFO Writing project to Flash on Tessel-02A3226BCFA3 (3.072 kB)...
INFO Deployed.
INFO Your Tessel may now be untethered.
INFO The application will run whenever Tessel boots up.
INFO To remove this application, use "t2 erase".
INFO Running index.js...

Where is my Tessel on my network?

>t2 wifi

INFO Looking for your Tessel...
INFO Connected to Tessel-02A3226BCFA3.
INFO Connected to "HANSELMAN"
INFO IP Address: 192.168.0.147
INFO Signal Strength: (33/70)
INFO Bitrate: 29mbps

Now I'll hit the webserver and there it is!

image

There's a lot of cool community work happening around Tessel.  You can get involved with the Tessel community if you're interested:

  • Join us on Slack — Collaboration and real time discussions (Recommended! - ask your questions here).
  • Tessel Forums — General discussion and support by the Tessel community.
  • tessel.hackster.io — Community-submitted projects made with Tessel.
  • tessel.io/community — Join a Tessel meetup near you! Meetups happen around the world and are the easiest way to play with hardware in person.
  • #tessel on Freenode — IRC channel for development questions and live help.
  • Stack Overflow — Technical questions about using Tessel

Sponsor: Big thanks to Telerik! They recently published a comprehensive whitepaper on The State of C#, discussing the history of C#, what’s new in C# 7 and whether C# is the top tech to know. Check it out!



© 2016 Scott Hanselman. All rights reserved.
     

Best of Best WordPress Tutorials of 2016 on WPBeginner

Another year is about to end and what a great year it was. We can’t thank you enough for your continued support of WPBeginner. We look back at 2016 and feel grateful for the success and joy our team achieved. WPBeginner 2016 Recap from Syed… Read More »

The post Best of Best WordPress Tutorials of 2016 on WPBeginner appeared first on WPBeginner.

Another year is about to end and what a great year it was. We can’t thank you enough for your continued support of WPBeginner. We look back at 2016 and feel grateful for the success and joy our team achieved.

Best of Best WordPress Tutorials of 2016 on WPBeginner

WPBeginner 2016 Recap from Syed Balkhi

Wow what a year has this been for WPBeginner. Not only did we grew in all aspects from traffic to team size to revenue (coming from our premium plugins), but we also got a new site design after 4 long years.

Our YouTube channel doubled in size. We now have over 500 free video tutorials that have been watched by over 6 million people, and we have almost 47,000 subscribers. I would really appreciate it if you can subscribe to our YouTube channel. My goal is to reach the 100,000 subscriber mark in 2017.

Amanda and I welcomed our first baby, Solomon (born in October). To celebrate, we donated the wp.org domain to the WordPress foundation. Several of you asked for a picture, so here it is:

Solomon Balkhi

This was also a great year for WPBeginner’s family of products.

In March, we launched a new WordPress contact form plugin. It’s called WPForms, and we have both a free version and a premium Pro version.

I wrote a full WPForms backstory about how and why we started WPForms on my personal blog. It’s a fun read.

So far it’s being used on over 50,000 WordPress websites, and our users absolutely love it. Try the free version, so you can see the WPForms difference!

Our WordPress gallery plugin, Envira Gallery, doubled in size. We now have over 30 addons that makes Envira the most flexible and easy to use WordPress gallery plugin in the market.

We did a major overhaul to our WordPress slider plugin, Soliloquy. Aside from the completely new website design, we also significantly optimized the plugin workflow and added several new addons.

Our signature product, OptinMonster, continued to push the limits in 2016. Our team nearly doubled in size, and we have added tons of conversion optimization features such as dynamic text replacement, onsite retargeting, onsite follow up campaigns, and so much more. Seriously, if you’re not using OptinMonster, then you’re losing subscribers every day.

Michael Stelzner from Social Media Examiner added 250,000 new email subscribers using OptinMonster (see the case study).

We have a lot of exciting things coming up in 2017 including the revamp of MonsterInsights in January.

If you want to keep up with more than just WPBeginner, then you can always follow me on Twitter (@syedbalkhi) where I tweet about our other projects, marketing tips, and tons of other cool things.

Now let’s take a look at the best of WPBeginner in 2016.

Best of WPBeginner in 2016

In 2016, we wrote tons of useful WordPress tutorials. Here’s a hand-picked list of some of our favorite ones.

January 2016

Who owns WordPress? And how does WordPress make money? – Many beginners often find it difficult to understand how open source software work. In this article, we answered the most frequently asked questions about who owns WordPress and how it makes money.

How to install Facebook remarketing/ retargeting pixel in WordPress – Facebook retargeting pixel allows you to track your website visitors on Facebook and show them ads. It helps you boost conversions and get more user engagement on your Facebook page as well.

Which is the best WordPress Popup Plugin? – We compared the performance and quality of best popup plugins for WordPress. We tested each of them for speed, features, ease of use, and pricing to find out which one is the best solution.

4 Ways to Prevent Image Theft in WordPress – Image theft is a common problem for photographers and bloggers. We shared 4 ways to prevent image theft on a WordPress powered website. While there’s no way to completely stop people from stealing your images, these ways help reduce image theft.

February 2016

WordPress vs static HTML – What’s best for your business website? – We are often asked by business owners about the advantage of using WordPress over static HTML website. In this article, we compared pros and cons of WordPress vs static HTML.

36 Reasons Why Having a “Free Website” is a Bad Idea – The thought of getting a free website is tempting. But there’s always a catch. We shared 36 reasons why having a free website is a bad idea and something you should AVOID at all costs.

How to Make a Niche Review Site in WordPress like a Pro – Want to create an online review site? We created a step by step guide on how to create a niche review site in WordPress like a Pro, so you can earn money from it.

How to Add an Author Bio Box in WordPress Posts – An easy way to add an author bio box with their social profile links at the end of each post. We shared 3 different methods, so you can choose the one that best suits your need.

March 2016

How to setup a professional email address with Google Apps and Gmail – The first thing every business owner needs is a professional email address. We walked you through a step by step guide on how to create a professional email address the RIGHT way.

How to properly move from Squarespace to WordPress – Many users start their websites using different platforms like Squarespace. Sooner they realize the limitations and find WordPress as the more flexible solution for their needs. In this article, we showed you how to properly move your website from Squarespace to WordPress.

How Sucuri helped us block 450,000 WordPress attacks – We use Sucuri to improve security of all our websites. In this article, we shared our case study and how Sucuri helped us improve WordPress security.

How to Send Thank You Email to Blog Commenters in WordPress – One of the best ways to engage users and keep them coming back after they leave a comment on your site. A simple thank you email goes a long way.

How to Add Facebook Like Emotional Reactions in WordPress – You’re probably familiar with the emotional reactions that Facebook added earlier this year. Well, you can add a similar feature on your blog posts to boost engagement.

April 2016

5 Best WordPress eCommerce plugins compared – Many of our users asked us about which eCommerce plugin they should use. In this article, we compared 5 best WordPress eCommerce plugins with pros and cons.

19 Actionable Tips to Drive Traffic to Your New WordPress Site – Ever wondered how can I get more traffic to my website? This article covers 19 different ways to increasing your traffic.

How to Add Google Search in a WordPress Site – We use the Google search on our website. This article shows you how to replace the default WordPress search with Google search for more relevant results.

How to Fix WordPress Not Sending Email Issue – Most WordPress hosting servers aren’t properly configured to send emails. This is quite frustrating because you might miss an important contact form inquiry or another email. You can fix this problem by following this tutorial.

May 2016

How to setup Facebook Instant Articles for WordPress – In this step by step tutorial, we explained pros and cons of Facebook Instant Articles as well as how to easily set it up on your WordPRess site.

Yoast SEO vs All in One SEO Pack – Which is the best WordPress SEO plugin? – In this article, we compared two of the most popular WordPress SEO plugins to find out which one is the best.

5 Best WordPress membership plugins – Want to build a membership website with WordPress? We compared the best WordPress membership plugins to find out which one offers the most features, flexibility, and ease of use.

How to Highlight New Posts for Returning Visitors in WordPress – Ever wondered how popular sites highlight new posts for returning visitors? Here’s an easy way to highlight unread WordPress posts to returning visitors.

June 2016

How to create a multilingual WordPress site with WPML – Want to build a multilingual website? In this article, we showed you how to easily build a multilingual WordPress site with WPML.

How to create a multi-page form in WordPress – Multi-page forms allow you to make lengthy forms much easier to fill. In this article, we showed you how to easily create multi-page forms in WordPress.

How to better manage automatic WordPress updates – Updates are important for security and stability of your WordPress site. However, if you manage multiple WordPress sites then updates can become a bit annoying. In this article, we showed you how to better manage automatic WordPress updates.

15 Most Annoying Things about WordPress and How to Fix Them – Like most things in life, WordPress also has it’s fair share of annoying things. We shared 15 most annoying things about WordPress and how to fix them.

July 2016

16 Best WordPress plugins for marketers – We are often asked by users about plugins they should use to market their website and products more effectively. In this article, we hand-picked some of the best WordPress plugins for marketers that can help you reach new customers and boost sales.

10 Awesome WordPress Features that You Probably Didn’t Know Existed – WordPress is always evolving and changing. We highlighted 10 hidden features that you probably didn’t know existed.

How to Create Bars and Charts in WordPress with Visualizer – Easiest way to create graphs, bars, pie charts, and more in WordPress without writing a single line of code.

August 2016

Beginner’s guide to troubleshooting WordPress errors (step by step) – Many beginners often find it difficult to figure out what’s causing an error on their WordPress site. In this guide, we compiled a step by step list of actions to troubleshoot WordPress errors and fixing them.

How to add web push notification to your WordPress site – Have you noticed the web push notifications used on popular websites like Facebook? In this article, we showed you how to easily add web push notifications to your WordPress site.

How to Add a Reading Progress Bar in WordPress – Have you noticed how some popular sites show a reading progress bar indicator at the top of their articles? Here’s how you can add one on your site as well.

September 2016

12 Tips to Optimize Your WordPress RSS Feed – Make the most out of your WordPress RSS feed with these 12 tricks.

How to create a custom user registration form in WordPress – Want to allow users to register on your WordPress site without visiting the WordPress admin area? In this article, we showed you how to easily create custom user registration forms in WordPress.

25 Most Common WordPress Errors and How to Fix Them – When you see a WordPress error, don’t panic. Simply refer to this guide where we cover how to fix the 25 most common WordPress errors.

Why Building Your Email List is so Important Today – Often bloggers and business owners ignore this subject, but they shouldn’t. We cover the top reasons why building an email list is crucial for your success.

October 2016

How to properly update live published posts in WordPress – Editing a live published post means you will have to finish the work in one go. You cannot save the changes mid-way. In this article, we showed you how to properly update live published posts in WordPress.

How to start your own podcast (step by step) – Want to start your own podcast using WordPress? In this step by step guide we showed you how to start your own podcast like a pro.

How to start an online store (step by step) – Want to start your own online store using WordPress? In this step by step guide, we showed you how to start an online store in 2016 and start selling.

The Ultimate WordPress Security Guide – WordPress security is a topic of huge importance for every website owner. In this guide, we covered all the top WordPress security tips to help you protect your website against hackers and malware.

Ultimate WordPress SEO Guide for Beginners – Improving your WordPress SEO is crucial for getting more traffic to your website. In this guide, we shared the top WordPress SEO tips to help you improve your WordPress SEO and get more organic traffic.

November 2016

How to allow users to submit posts to your WordPress site – Want to accept articles and guest posts from users on your site? In this article, we showed you how to easily allow users to submit posts to your WordPress site.

The Ultimate Guide to Boost WordPress Speed & Performance – Speed not only improves user experience on your website, it also helps you rank higher in search results. In this guide, we showed you how to improve WordPress performance and speed.

16 tools to create better images for your blog posts – Want to add beautiful images to your blog posts but don’t have graphic design skills? In this article, we hand-picked the best tools to create better images for your blog posts without any design skills.

How to Choose the Best Blogging Platform (Comparison) – We compared the top 10 most popular blogging platforms to help you decide which is the best one. You can take a guess which one won.

December 2016

15 best tutorials to master WordPress navigation menus – We compiled a list of all the best tutorials to help you master WordPress navigation menus like a pro.

How to Move WordPress to a New Host or Server with no Downtime – Looking to switch hosting providers? HEre’s a step by step guide on how to properly migrate your site without downtime.

How to Setup Google AMP in WordPress – Step by step guide on how to properly setup Google AMP on your WordPress site.

These were some of the best WordPress tutorials on WPBeginner in 2016. We hope that you liked them.

We would like to thank all our users for supporting us by offering feedback, sharing our articles, leaving comments, and suggesting topic ideas. We are really very thankful. We hope to add even more useful tutorials in 2017.

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 Best of Best WordPress Tutorials of 2016 on WPBeginner appeared first on WPBeginner.

How to Add Underline and Justify Text Buttons in WordPress

Are you looking for the missing underline and justify button in WordPress post editor? These buttons were removed from the post editor in WordPress 4.7. But there’s a way to bring them back. In this article, we will show you how to add underline and… Read More »

The post How to Add Underline and Justify Text Buttons in WordPress appeared first on WPBeginner.

Are you looking for the missing underline and justify button in WordPress post editor? These buttons were removed from the post editor in WordPress 4.7. But there’s a way to bring them back. In this article, we will show you how to add underline and justify text buttons in WordPress.

Underline and Justify Text in WordPress

Method 1: Using Re-add Text Underline and Justify Plugin

First thing you need to do is install and activate the Re-add Text Underline and Justify plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » Writing page to configure the plugin settings.

Re-Add underline and justify text plugin settings

The plugin comes with two options to choose from.

You can add the underline and justify text buttons, so they will appear in the second row of the post editor buttons.

Alternatively, you can choose to re-add buttons and rearrange. This will put underline and justify text buttons in the same position as they were before WordPress 4.7.

Don’t forget to click on the save changes button to store your settings.

You can now visit Posts » Add New page, and you will find underline and justify text buttons added back to the post editor.

Underline and Justify text buttons added back in WordPress post editor

Method 2: TinyMCE Advanced Plugin

This method allows you to do a lot more than just adding the underline and justify text buttons. You can add custom styles, add missing buttons, and even create your own buttons.

First, you need to install and activate the TinyMCE Advanced plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit Settings » TinyMCE Advanced page to configure plugin settings.

Drag and drop underline and justify text buttons to the post editor

You will notice a preview of the WordPress post editor. Below the preview, it will show you all the unused buttons.

Now you need to drag and drop underline and justify text buttons from ‘Unused Buttons’ box to the post editor.

Don’t forget to click on the save changes button to store your settings.

You can now create a new post or edit an existing one. You will notice that the default WordPress post editor is replaced by the TinyMCE Advanced editor.

We hope this article helped you learn how to add underline and justify text buttons in WordPress. You may also want to see our list of tips for mastering the WordPress visual editor.

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 Add Underline and Justify Text Buttons in WordPress appeared first on WPBeginner.

How to Regenerate PDF Thumbnails in WordPress

Recently, one of readers users asked if it was possible to regenerate PDF thumbnails for old uploads in WordPress? In WordPress 4.7, you now have thumbnail previews for all new PDF files. However, this change does not affect older uploads. In this article, we will… Read More »

The post How to Regenerate PDF Thumbnails in WordPress appeared first on WPBeginner.

Recently, one of readers users asked if it was possible to regenerate PDF thumbnails for old uploads in WordPress? In WordPress 4.7, you now have thumbnail previews for all new PDF files. However, this change does not affect older uploads. In this article, we will show you how to regenerate PDF thumbnails in WordPress for older uploads.

Regenerate PDF thumbnails for old uploads in WordPress

Why and Who Needs to Regenerate PDF Thumbnails?

WordPress introduced PDF thumbnail previews in WordPress 4.7. This feature creates image previews of the first page of a PDF file uploaded using media uploader.

However, this feature only works on new PDF files that you uploaded after updating your site to WordPress 4.7.

All older PDF files will still appear as a generic icon in the media library, and you will still have to use a PDF plugin to show a thumbnail preview on attachment pages.

If you regularly upload PDF files, then you will need to regenerate thumbnail for your older PDF uploads.

It is similar to regenerating thumbnails for images after adding new image sizes to your WordPress theme. However, those plugins do not support PDF files at the moment.

Having said that, let’s take a look at how to regenerate PDF thumbnails for older uploads in WordPress.

Regenerate PDF Thumbnails in WordPress

Before you move on, please make sure that you are using WordPress 4.7 or higher. Also make sure that you have imagemagick extension installed on your server.

You can test imagemagick by simply uploading a PDF file to your WordPress site. If it shows a thumbnail preview for your PDF file, then you are good to go.

Please note, that the plugin we are going to use in this article, will regenerate thumbnails for all your older image files as well. As a precaution, backup your WordPress site or at least backup your /wp-content/uploads/ folder.

First thing you need to do is install and activate the Force Regenerate Thumbnails plugin.

The plugin is hosted on GitHub. If you haven’t installed plugins from GitHub before, then take a look at our guide on how to install WordPress plugins from GitHub.

Upon activation, you need to visit Tools » Force Regenerate Thumbnails page.

Regenerate all thumbnails

Here you can regenerate thumbnails for all images and PDF files you uploaded using WordPress media uploader. Click on ‘Regenerate All Thumbnails’ button to continue.

The plugin will now start processing all images on your website. It will take some time, depending on how many images and PDF files you have.

Once finished, you can visit Media » Library page and you will be able to see thumbnail previews for your old PDF uploads.

Media library

The plugin also allows you to regenerate thumbnails for individual files. If you do not have many PDF files, then it would be better to regenerate thumbnails individually.

You will need to visit Media » Library page and switch to the list view by clicking on the list view button.

After that take your mouse over to a PDF file, and you will be able to see ‘Force regenerate thumbnails’ link.

Generating thumbnail for a single PDF file in WordPress

Clicking on the link will regenerate thumbnails for that particular file.

Once you have regenerated thumbnails for all your old PDF uploads, you can safely deactivate and delete the plugin. Uninstalling or deleting the plugin will not delete the thumbnails regenerated by the plugin.

We hope this article helped you regenerate PDF thumbnails for old uploads in WordPress. You may also want to see our list of 24 must have WordPress plugins for business websites.

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 Regenerate PDF Thumbnails in WordPress appeared first on WPBeginner.

How to View and Control WordPress Cron Jobs

Recently, one of our readers asked if it was possible to view and control the WordPress cron job system in the dashboard. Cron is a technology to run scheduled tasks on web server. WordPress comes with its own built-in cron that allows it to perform… Read More »

The post How to View and Control WordPress Cron Jobs appeared first on WPBeginner.

Recently, one of our readers asked if it was possible to view and control the WordPress cron job system in the dashboard. Cron is a technology to run scheduled tasks on web server. WordPress comes with its own built-in cron that allows it to perform scheduled tasks such as checking for updates, publishing schedule posts, etc. In this article, we will show you how to view and control WordPress cron jobs.

What is WordPress Cron? How it Works?

Cron is a technical term used for commands to run on scheduled time or at regular intervals. Most web servers use it to maintain the server and run scheduled tasks.

WordPress comes with its own cron system which allows it to perform scheduled tasks. For example, checking for updates, deleting old comments from trash, etc.

Plugins can also use it to perform tasks specified by you.

For example, your WordPress backup plugin can use WordPress cron to automatically create backups at given schedule.

Irresponsible use of WordPress cron by plugins can slow down your website. Specially, if you are on shared hosting.

If a plugin frequently performs resource intensive tasks, then you need to identify the issue and fix it.

Let’s take a look at how to view and control the WordPress cron system without writing any code.

View and Control WordPress Cron System

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

Upon activation, you need to visit Tools » Cron Events page to control cron settings.

WordPress Cron events

You will see a list of all cron events scheduled to run on your site using the WordPress cron system.

In the first column, you will see the name of the hook that runs the cron.

Hook names usually give you a hint at what this particular event does.

Most default WordPress hooks begin with a wp_ prefix, like wp_update_plugins, wp_update_themes, etc.

Your WordPress plugins may or may not use their own prefixes for their hooks. For example, yoast seo uses wpseo_ prefix.

You will also get to see when a cron will run next, and the time interval between next run.

The last column on the list allows you to edit, delete, or run a cron event.

Important: Be very careful about what you do with cron events and never delete a default WordPress cron event.

Now let’s suppose you see a cron event created by a WordPress plugin that is quite resource intensive.

First, you should check the plugin’s settings to see if there is an option to control it from there. If there isn’t, then you can click on the ‘Edit’ link next to the cron event to change it.

Editing a cron in WordPress

Clicking on the Edit button will open the ‘Modify cron event’ tab down below.

Here you can change how often you want the event to run.

Modifying cron settings

Once you are done, click on the save changes button to store your settings.

Adding Your Own Cron Events in WordPress

WP Control plugin makes it easy to add your own cron jobs to WordPress. Simply visit Tools » Cron Events page and scroll down to ‘Add Cron Event’ tab.

Add custom cron event in WordPress

First you need to provide a hook name for your cron event. Hook names cannot have spaces or special characters.

If the function you want to execute requires arguments, then you can provide those arguments.

Next, you need to tell WordPress when to run the cron next time. You can enter ‘now’ which will trigger cron immediately, ‘tomorrow’, ‘+2 days’, or ’25-02-2020 12:34:00′.

Lastly, you need to select a schedule. You can select hourly, twice daily, daily, or once a week. You can also make it non-repeating event.

Once you are done, click on the Add Cron Event button to save your changes.

You will notice that your cron event will now appear in the events list.

However, currently it does nothing because you haven’t told WordPress what to do when this event is triggered.

You will need to add your hook and a function that runs when the cron hook is triggered.

if ( ! wp_next_scheduled( 'wpb_custom_cron' ) ) {
  wp_schedule_event( time(), 'hourly', 'my_task_hook' );
}

add_action( 'wpb_custom_cron', 'wpb_custom_cron_func' );

function wpb_custom_cron_func() {
  wp_mail( [email protected]', 'Automatic email', 'Automatic scheduled email from WordPress to test cron');
}

Don’t forget to use your own email address.

This function simply sends a test email to you when the cron runs. You can now scroll up the page and click on the ‘Run Now’ link next to your cron event to test it out.

Note: Using cron requires intermediate level programming and WordPress development skills.

That’s all we hope this article helped you learn how to view and control WordPress cron jobs. You may also want to see our ultimate guide to speed up WordPress and boost performance.

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 View and Control WordPress Cron Jobs appeared first on WPBeginner.

How to View and Control WordPress Cron Jobs

Recently, one of our readers asked if it was possible to view and control the WordPress cron job system in the dashboard. Cron is a technology to run scheduled tasks on web server. WordPress comes with its own built-in cron that allows it to perform… Read More »

The post How to View and Control WordPress Cron Jobs appeared first on WPBeginner.

Recently, one of our readers asked if it was possible to view and control the WordPress cron job system in the dashboard. Cron is a technology to run scheduled tasks on web server. WordPress comes with its own built-in cron that allows it to perform scheduled tasks such as checking for updates, publishing schedule posts, etc. In this article, we will show you how to view and control WordPress cron jobs.

What is WordPress Cron? How it Works?

Cron is a technical term used for commands to run on scheduled time or at regular intervals. Most web servers use it to maintain the server and run scheduled tasks.

WordPress comes with its own cron system which allows it to perform scheduled tasks. For example, checking for updates, deleting old comments from trash, etc.

Plugins can also use it to perform tasks specified by you.

For example, your WordPress backup plugin can use WordPress cron to automatically create backups at given schedule.

Irresponsible use of WordPress cron by plugins can slow down your website. Specially, if you are on shared hosting.

If a plugin frequently performs resource intensive tasks, then you need to identify the issue and fix it.

Let’s take a look at how to view and control the WordPress cron system without writing any code.

View and Control WordPress Cron System

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

Upon activation, you need to visit Tools » Cron Events page to control cron settings.

WordPress Cron events

You will see a list of all cron events scheduled to run on your site using the WordPress cron system.

In the first column, you will see the name of the hook that runs the cron.

Hook names usually give you a hint at what this particular event does.

Most default WordPress hooks begin with a wp_ prefix, like wp_update_plugins, wp_update_themes, etc.

Your WordPress plugins may or may not use their own prefixes for their hooks. For example, yoast seo uses wpseo_ prefix.

You will also get to see when a cron will run next, and the time interval between next run.

The last column on the list allows you to edit, delete, or run a cron event.

Important: Be very careful about what you do with cron events and never delete a default WordPress cron event.

Now let’s suppose you see a cron event created by a WordPress plugin that is quite resource intensive.

First, you should check the plugin’s settings to see if there is an option to control it from there. If there isn’t, then you can click on the ‘Edit’ link next to the cron event to change it.

Editing a cron in WordPress

Clicking on the Edit button will open the ‘Modify cron event’ tab down below.

Here you can change how often you want the event to run.

Modifying cron settings

Once you are done, click on the save changes button to store your settings.

Adding Your Own Cron Events in WordPress

WP Control plugin makes it easy to add your own cron jobs to WordPress. Simply visit Tools » Cron Events page and scroll down to ‘Add Cron Event’ tab.

Add custom cron event in WordPress

First you need to provide a hook name for your cron event. Hook names cannot have spaces or special characters.

If the function you want to execute requires arguments, then you can provide those arguments.

Next, you need to tell WordPress when to run the cron next time. You can enter ‘now’ which will trigger cron immediately, ‘tomorrow’, ‘+2 days’, or ’25-02-2020 12:34:00′.

Lastly, you need to select a schedule. You can select hourly, twice daily, daily, or once a week. You can also make it non-repeating event.

Once you are done, click on the Add Cron Event button to save your changes.

You will notice that your cron event will now appear in the events list.

However, currently it does nothing because you haven’t told WordPress what to do when this event is triggered.

You will need to add your hook and a function that runs when the cron hook is triggered.

if ( ! wp_next_scheduled( 'wpb_custom_cron' ) ) {
  wp_schedule_event( time(), 'hourly', 'my_task_hook' );
}

add_action( 'wpb_custom_cron', 'wpb_custom_cron_func' );

function wpb_custom_cron_func() {
  wp_mail( [email protected]', 'Automatic email', 'Automatic scheduled email from WordPress to test cron');
}

Don’t forget to use your own email address.

This function simply sends a test email to you when the cron runs. You can now scroll up the page and click on the ‘Run Now’ link next to your cron event to test it out.

Note: Using cron requires intermediate level programming and WordPress development skills.

That’s all we hope this article helped you learn how to view and control WordPress cron jobs. You may also want to see our ultimate guide to speed up WordPress and boost performance.

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 View and Control WordPress Cron Jobs appeared first on WPBeginner.