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 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.

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.

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.

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 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.

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 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.

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 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( 'you@example.com', '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.