Tuesday, December 20, 2022

How to Improve Your 404 Page Template in WordPress (2 Ways)

Do you want to improve your 404 page template in WordPress?

By replacing the default WordPress 404 page with your own design, you can improve the visitor experience and keep people on your site for longer.

In this article, we’ll show you how to customize your 404 page template in WordPress.

How to improve your 404 page template in WordPress

Why Improve Your 404 Page Template in WordPress?

Most WordPress themes come with a basic 404 template, including the default WordPress ones. For example, in the following image, you can see Twenty Twenty-Two’s 404 page.

The default WordPress 404 page

However, most of these default templates are simple and don’t show any content from your site. This means that anyone who lands on your 404 page is more likely to leave your WordPress website, which will increase your bounce rate.

This is bad news for your WordPress SEO, and may affect where your site appears in the search engine rankings.

That being said, it’s a good idea to create a 404 page with your own content and branding.

For example, at WPBeginner we show a custom image and encourage visitors to contact us, so we can fix the 404 error. The sidebar also has links to our social media profiles and even some information about an ebook download.

The WPBeginner custom 404 page

This is also a chance to promote your most popular posts or products from your online store. In this way, your 404 page can add value for your visitors, which will increase pageviews and reduce bounce rate.

If you’re looking for inspiration, then we’ve collected the best 404 error page design examples for you to look at.

Note: Even if you design an engaging and helpful page, you’ll still want to fix any 404 errors. Here, it helps to track your 404 pages and redirect them.

With that said, let’s take a look at how you can improve your 404 page template in WordPress.

Video Tutorial

If you’d prefer written instructions, just keep reading. You can also use the quick links below to jump straight to the method you want to use.

The best way to improve the 404 page template is by using the SeedProd page builder plugin.

SeedProd is the best landing page builder for WordPress. It lets you create, edit, and customize your WordPress pages without writing any code.

With this plugin, you can easily create a custom 404 page using a wide range of professionally-designed templates.

The first thing you need to do is install the SeedProd plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

Note: There is a free version of SeedProd available, but we’ll be using the Pro version since it lets you replace your theme’s built-in 404 template.

After activating the plugin, SeedProd will ask for your license key.

SeedProd license key

You can find this information under your account on the SeedProd website. After entering the license, click on the ‘Verify Key’ button.

Once you’ve done that, go to SeedProd » Landing Pages. In the ‘404 Page’ section, click on ‘Set up a 404 Page.’

The SeedProd page builder plugin

You can now choose a template for your 404 page.

To preview a design, simply hover your mouse over it and then click on the magnifying glass.

SeedProd's ready-made 404 templates

When you find a design that you like, just click on ‘Choose This Template.’

We’re using the ‘Oh No 404 Page’ template, but you can use any design you like.

Choosing a professionally-designed 404 template

After selecting a template, you’ll be taken to the drag-and-drop builder, where you can start customizing the 404 page.

On the left side of the screen, you’ll find blocks and sections that you can add to your design. The right side of the page is the live preview.

Building a custom 404 page for your WordPress website

Most 404 templates already have some blocks, which are a core part of all SeedProd designs.

To customize any of these ready-made blocks, simply click to select the block in your layout. You can then customize the block using the settings in the left-hand menu.

Changing the text in a custom 404 page

To add a new block to your design, simply find the block in the left-hand menu. Then, drag it onto your layout. You can now customize the block following the process described above.

To start, you’ll typically want to add your own website logo to the 404 page.

To replace the SeedProd logo with your own branding, simply click to select the placeholder logo in your layout. Then, hover over the image in the left-hand menu and click on the ‘Select Image’ button.

Adding your own logo to a 404 page

This launches the WordPress media library, where you can select any image or upload a new file from your computer.

Many 404 templates also display your site’s main navigation menu by default. If you have multiple menus, then you may prefer to show a different menu instead.

To make this change, simply click on the ‘Nav Menu’ block in your template. You can then open the ‘Menu’ dropdown and choose any menu from the list.

Adding a custom navigation menu to a 404 page

For more information, please see our guide on how to add custom navigation menus in WordPress themes.

You can create any design simply by adding and customizing blocks. However, when someone arrives at your 404 page, they may be confused about what to do next.

With this in mind, we’ll show you how to promote your most popular posts and create a contact form, so visitors can report any broken links or missing content.

To start, add a ‘Headline’ and a ‘Text’ block to your design. You can then type your message into the text editor in the left-hand menu.

For example, in the following image, we’ve created a headline that explains the page can’t be found and a ‘Text’ block that suggests reading some posts or using the contact form.

Adding text to a custom 404 page

Next, we’re going to change the ‘Back To Home’ button so it encourages people to check out a particular post instead of going to the general homepage.

You might include a link to the most popular post on your WordPress blog or the one that helps you make the most money online blogging.

To customize the button, simply click to select it in the page layout. Then, type the post’s URL into the ‘Link’ field.

Changing the button label

To change the text that appears on this button, simply type into the ‘Button Text’ box.

Once you’ve done that, click on the ‘Advanced’ tab. Here, you can change the button’s color, size, and more.

Creating a custom CTA button

Add Your Most Popular Posts to Your WordPress 404 Page

Next, you can add a list of your most popular posts to the 404 page. Since these articles are popular, there’s a good chance visitors will find something they like.

You can create this list automatically using the MonsterInsights plugin. It’s the best analytics solution for WordPress used by over 3 million websites.

MonsterInsights can see which posts get the most visitors and add them to your 404 page. For more details, see our guide on how to display popular posts by views in WordPress.

After activating MonsterInsights, you can display your most popular posts by adding shortcode in WordPress. In SeedProd’s left-hand menu, simply find the ‘Shortcode’ block and drop it onto your layout.

How to add shortcode to your website's 404 page

Then, click to select the ‘Shortcode’ block. This will open the settings window to the left. Next, copy the following shortcode:

[monsterinsights_popular_posts_widget theme="beta"]

Then, in the box labeled ‘Content,’ paste it into the text area labeled ‘Shortcode.’

Adding shortcode to you website's 404 page

By default, SeedProd doesn’t show a preview of your most popular posts inside the page editor, so you’ll need to click on the ‘Preview’ button in the upper-right corner. This opens your design in a new tab.

If you prefer to preview the popular posts list inside the page editor, then simply click on the ‘Show Shortcode Preview’ switch.

Previewing the 404 page's shortcode

In the above shortcode, we’re using theme=“beta” for our list, but MonsterInsights has a few different themes that you can use.

To see the different themes, go to Insights » Popular Posts in the WordPress dashboard and then click on ‘Popular Posts Widget’.

The MonsterInsights popular posts settings

You can now click on the different themes to see a preview.

When you find a design that you want to use, simply update the shortcode in SeedProd. For example, if you want to use the ‘Alpha’ theme then you would need to type in:

[monsterinsights_popular_posts_widget theme="alpha"]

Add a Contact Form to Your WordPress 404 Page

You may also want to add a contact form so visitors can reach out if they can’t find what they’re looking for. This form also gives people an easy way to report broken links, so you can fix them and improve the experience for future visitors.

For more information, please see our complete guide on how to fix broken links in WordPress.

The best way to add a contact form to your site is by using the WPForms plugin. It’s the best contact form plugin for WordPress and comes with a user-friendly drag-and-drop form builder.

For more details, see our step-by-step guide on how to create a contact form in WordPress.

Once you’ve created a contact form, it’s easy to add that form to your 404 page. Simply find the ‘Contact Form’ block and drag it onto your design.

The WPForms form builder plugin

Then, open the ‘Select a Form’ dropdown and choose your contact form from the list.

The page editor will now show a preview of the contact form.

How to add a contact form to your website's 404 page

You might want to add some text introducing your contact form or encouraging visitors to get in touch.

To do this, simply add a ‘Headline’ or ‘Text’ block above your contact form and then type in the text that you want to use.

A custom 404 page, created using SeedProd

When you’re happy with how the 404 page looks, it’s time to publish it.

Simply click the dropdown arrow next to ‘Save’ and then select ‘Save as Template.’

Saving your SeedProd 404 template

When asked, go ahead and type in a name for the template. This is just for your reference so you can use anything you want.

After that, click on ‘Save Template.’

Naming your WordPress template

In the next popup, click on ‘Return to Page Editor.’ You can then click on the ‘X’ button in the upper-right corner to close the SeedProd page editor.

At this point, you may see a popup asking whether you want to publish your new 404 design. If you’re happy to go ahead, then click on ‘Yes, Activate.’

Activating a SeedProd template for your WordPress website

If you don’t want to publish the template right now, then click on ‘No, Close’ instead.

After that, you can publish the design at any point by going to SeedProd » Pages. Here, click on the switch in the ‘404 Page’ section so it shows ‘Active.’

Activating a template for your WordPress website

To see your 404 page in action, just add /404 to the end of your domain name.

After publishing your custom 404 page, it’s a good idea to track how people are engaging with that page. This allows you to see what’s working and what isn’t working, so you can fine-tune your 404 design to get more conversions and engagement.

To learn more, see our beginner’s guide on how to install Google Analytics in WordPress.

Method 2. Create a Custom 404 Page in WordPress By Adding Code

If you don’t want to use a page builder plugin, then you can create a custom 404 page using code. However, just be aware that any mistakes in your code can cause common WordPress errors, or even break your site.

With that in mind, this method isn’t recommended for beginners. It’s also a good idea to back up your site before using this method, just in case you encounter any problems.

To get started, you’ll need an FTP client such as FileZilla, or you can use the file manager supplied by your WordPress hosting provider.

If this is your first time using FTP, then you can see our complete guide on how to connect to your site using FTP.

After connecting to the server, go to /wp-content/themes/ and then open the folder for your current WordPress theme.

The FileZilla FTP client

If this folder already has a 404.php file, then you can go ahead and open that file in any text editor, such as Notepad.

If your theme doesn’t have a 404.php file, then you’ll need to create one. After that, go ahead and open the file in a text editor app.

Editing the 404.php file template

You’re now ready to create a custom 404 design using code. You can create all sorts of designs, but here’s some simple examples to help you get started.

Display Most Popular Posts on 404 Page

A list of your most popular posts can encourage visitors to check out your site’s best content.

You can create this list using WordPress Popular Posts. It’s one of the best popular posts plugins for WordPress and comes with template tags that you can add to your 404.php file.

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

Upon activation, you can add a list of popular posts to your 404 page using the following template tag:

<?php wpp_get_mostpopular(); ?>

Display Most Commented Posts on 404 Page

This plugin can also display the posts that have the most comments.

In your 404.php file, simply find the area where you want to show your most commented posts, and then add the following template tag:

<?php wpp_get_mostpopular("range=all&order_by=comments"); ?>

You can also check out our guide on how to display most commented posts in WordPress.

Display Recent Posts on 404 Page

Another option is to show your site’s most recent posts. This can be particularly effective if you post time-sensitive blogs, for example if you run a news aggregator website.

There are several different ways to display recent posts in WordPress, but the easiest way is adding a template tag to your 404.php file:

<?php wp_get_archives( array( 'type' => 'postbypost', 'limit' => 10, 'format' => 'custom', 'before' => '', 'after' => '<br />' ) ); ?>

Display Random Posts on 404 Page

Do you want to show a random list of posts on your custom 404 page?

Then simply add this code to your 404.php file:

<ul>
<?php
$posts = get_posts('orderby=rand&numberposts=5');
   foreach($posts as $post) { ?>
        <li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
        </li>
   <?php } ?>
</ul>

Add Monthly Archives with Compact Archives

If you have lots of content, then it may be impossible to show all those posts on your custom 404 page.

One option is to organize your content into monthly archives. Visitors can then click to explore content from different months and years.

Here at WPBeginner, we display our monthly archives on our 404 page using the Compact Archives plugin. This helps visitors browse all of our content, without overwhelming them with a long list of posts.

An example of a compact archive

For more details, see our guide on how to create compact archives in WordPress.

After activating the Compact Archives plugin, simply add the following code to your 404.php file:

<p><strong>By Date</strong></p>
<ul>
<?php compact_archive($style='block'); ?>
</ul>

Now, when a user lands on your 404 page they’ll see your compact post archives.

We hope this article helped you improve your 404 page template in WordPress. You may also want to see our guide on how to set up Google Analytics goals for your WordPress site and our expert pick of the best virtual business phone number apps.

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 Improve Your 404 Page Template in WordPress (2 Ways) first appeared on WPBeginner.


December 21, 2022 at 01:02AM

How to Embed Discord Widget into WordPress

Are you looking to embed a Discord widget in WordPress?

Discord is a well-known VOIP chat application that allows you to build your own communities and enables your users to communicate with each other through text, voice, and video. As of 2022, Discord has about 150 million active users.

In this article, we will show you how to embed a Discord widget into WordPress.

How to Embed Discord Widget into WordPress

Why Should You Add a Discord Widget to Your Website

Discord chat allows users to communicate with each other over messages, voice calls, and video calls.

By embedding a Discord widget in your WordPress site, you can provide a way for your users to connect with each other. This widget will display the total members of your Discord server, and it will also provide an invite link for new members to join.

Your WordPress users will be able to join your Discord chat rooms through the link provided by the widget, so you can build a huge community for your website.

That being said, let’s see how you can add a Discord widget in WordPress.

How to Embed a Discord Widget in WordPress

To embed a Discord widget in WordPress, you must visit the official Discord website. You will need to create a Discord user account and create a Discord server for your community.

Step 1. Creating a Discord Username and Server

Once there, simply click the ‘Login’ button present at the top right corner if you already have a Discord account.

If you don’t have an account, click the ‘Open Discord in your browser’ button.

Login to your Discord account or create a new account

You will be then asked to choose a username for your Discord account.

This will be your handle for others to find you, but you can change your display name on a server-by-server basis.

Choose a username for your discord account

Next, Discord will take you to the ‘Channels’ page and then ask for your date of birth.

Simply enter your details and click the ‘Next’ button.

Type your date of birth and click Next button

Then, you’ll be asked to create your first Discord server. Now, you can either create your own template or choose any of the premade ones.

For this tutorial, we will be using the ‘Gaming’ server template.

Create a discord server

After that, you’ll be asked to choose a ‘Server Name’ for your Discord chatroom. You can also upload an image for the server.

After choosing a name of your liking and uploading an image, simply click the ‘Create’ button to create your Discord server.

Type a name for your discord server

Lastly, you’ll be asked to provide your email account and choose a password for your Discord account.

Once you provide these details, click the ‘Claim Account’ button.

Provide your email and password

Now, an email will be sent by Discord to the email account you provided to verify your details.

Once you verify your account, your Discord server will be set up.

Email for verification

Now all you have to do is embed the Discord widget in WordPress.

For that, first, you need to click the arrow icon present beside your server name at the top of the Discord ‘Channels’ page.

Click arrow icon beside your server

This will open up a dropdown menu.

Here, you simply have to click the ‘Server Settings’ option to open up your Discord server settings.

Click server settings option

Once you’re on the ‘Server Settings’ page, click the ‘Widget’ option from the sidebar.

This will open up the ‘Server Widget’ section where you simply have to toggle the switch present beside ‘Enable Server Widget’.

Toggle the enable server widget switch

After that, simply scroll down to the ‘Premade Widget’ section and click the ‘Copy’ button present below the ‘Premade Widget’ option.

You can now embed the Discord widget anywhere on your website by pasting this code.

Copy premade widget shortcode
Step 2. Embedding the Discord Widget in WordPress

First, go to the WordPress page or post where you want to embed the Discord widget.

Then, simply choose the ‘Custom HTML’ block from the block editor and paste the code.

embed shortcode in Custom HTML block

After that click the ‘Publish’ button at the top to embed the Discord widget.

This is how your Discord widget will look on your WordPress website.

Discord widget on your website

Note that you can embed the Discord widget in any block-enabled area of your themes, such as a sidebar, header, or footer.

We hope you learned how to embed the Discord widget in WordPress. You may also want to check our top picks of the best VOIP themes in WordPress and our article on the best email marketing services for small businesses.

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 Embed Discord Widget into WordPress first appeared on WPBeginner.


December 20, 2022 at 03:55PM

Monday, December 19, 2022

How to Show Random Quotes in Your WordPress Sidebar

Do you want to show random quotes in the WordPress sidebar?

Displaying quotes from happy customers can convince more visitors to buy your products. Or you might simply want to brighten your audience’s day by showing them a random inspirational quote. 

In this article, we will show you how to easily show random quotes in the WordPress sidebar by using a free plugin.

How to Show Random Quotes in WordPress Sidebar

How to Show Random Quotes in Your WordPress Sidebar

You can show random quotes in the WordPress sidebar using the Quotes and Tips plugin. It lets you add an unlimited number of quotes to your site.

It also lets you display quotes on any page, post, or widget area, including your WordPress sidebar.

First, you’ll need to install and activate the plugin. If you need help, then please see our guide on how to install a WordPress plugin

After activating the plugin, you can start adding quotes. To add your first quote, go to Quotes » Add New.

How to add a new random quote

First you’ll need to type a title for your quote into the ‘Add Title’ field. In a later step, we’ll show you how to choose whether or not to display the quote’s title to your visitors, or use it for internal reference only.

Next, type your quote into the text editor. In our example, we’re using a quote from a case study.

A quote from an OptinMonster customer

You may want to organize your quotes into categories. This becomes important when it’s time to display your quotes.

Basically, you have two options.

The Quotes and Tips plugin can select a random quote from all of the quotes you’ve added. Or, it can select a random quote from a specific quote category.

For example, if you have an online store, you might want to display quotes about a specific product on that product page only.

If you already have some categories in mind, then it makes sense to organize your quotes into these categories now. But you can always add, remove, and edit your categories later. We’ll be covering that at the end of the post.

If you do want to create a quote category now, then you can find the Quotes Categories box on the right side of the page.

To add your category, first click on the ‘Add New Quotes Category’ link.

Adding a new quote category

A field will display where you can type your category name. The category won’t appear to your visitors, so it’s just for your reference.

After you type it in, click on the ‘Add New Quotes Category’ button. 

This category will now appear in the Quotes Category tab. To add the current quote to this category, simply select the category’s checkbox. 

Selecting a quote category in the WordPress dashboard

You can keep repeating these steps to create more quote categories. 

Next, you’ll typically want to show where a quote comes from. This might be a valued customer, a famous brand, or even a celebrity.

To assign your quote to a person or company, scroll down to the ‘Name and Official Position’ section.

You can now type the person or company’s name into the Name field. 

The Name and Official Position settings

You might also want to add this person’s job title, or some information that explains why they’re qualified to make this statement. You can type this information into the Official Position field.

When you’re happy with your quote, click on the Publish button. 

You can now repeat these steps to create all of the quotes that you want to show in your WordPress sidebar.  

Configuring Your Quotes and Tips Settings 

After creating your quotes, it’s time to take a look at the Quotes and Tips settings. This contains some important settings that control how and when your site displays a random quote. 

To take a look at these settings, go to Tips » Settings

The Quotes and Tips settings page

By default, Quotes and Tips will display a new quote every time the page reloads. This means visitors will see a new quote every time they visit a new page or press the Refresh button in their web browser. 

If you prefer, you can display a new quote automatically every few seconds or minutes. The visitor doesn’t even have to refresh their web browser.

To do this, select ‘AJAX (no page reload).’ You can then find the Change Frequency field. Here, simply type how frequently WordPress should display a new quote in seconds.

Changing the quote frequency

Next, it’s time to choose the title that will appear above your quote. 

The default setting is ‘Set Title From Post’. This will display the title you entered when adding the quote to WordPress.

Another option is creating a title that WordPress will use for all of your quotes. This might be something such as ‘Words of Wisdom’ or ‘Don’t take our word for it! Here’s what our customers think’ for testimonials.

To use the same title for all your quotes, click on ‘Set Custom Titles.’ You can now type your title into the Quote Title field. 

Setting your quote title in the WordPress dashboard

When you’re finished, don’t forget to click on the Save Changes button. 

How to Display a Random Quote 

Now it’s time to display your quotes.

Let’s start by showing a random quote from your entire quote collection. If you’ve created multiple categories, then this method will ignore all of these categories. 

You can add your quote to any page, post, or widget using the Quotes and Tips shortcode. To get this shortcode, go to Quotes » Settings

Now, copy the shortcode in the ‘Quotes and Tips’ section.

The WordPress quotes shortcode

Another option is to simply copy the following: [quotes_and_tips]

Since we want to show random quotes in the WordPress sidebar, you’ll need to go to Appearance » Widgets. This shows all the areas of your site that support widgets. 

The WordPress 'Widgets' settings

This screen may look slightly different depending on your WordPress theme. However, most modern WordPress themes have a sidebar. 

Find the Main Sidebar or similar section, and give it a click. This section will now expand.

The WordPress Main Sidebar settings

You need to add a Shortcode block to this widget, so click on the + button. In the search field, type Shortcode. 

You can now select the Shortcode block when it appears. Next, either paste or type the shortcode into this block. 

Finally, click on the blue Update button at the top of the screen. Now, if you visit your website you should see a random quote in your WordPress sidebar. 

How to Display Random Quotes From a Specific Category 

Another option is to display a quote from a specific quote category.

To display a random quote from a particular category, you’ll need to use a different shortcode.

To get this code, head over to Quotes » Quote Category

Here, you’ll find a list of all the categories you’ve created. Each category has its own shortcode. 

A list of WordPress quote categories

Simply find the category that you want to use, and copy its shortcode. You can then paste this shortcode into any page, post, or widget, following the same process above.

How to Style and Brand Your Random Quotes

By default, Quotes and Tips adds a blue background to the quote area. It also uses a background image of silhouettes.

You can change this default styling to better match the rest of your website’s design. You can even remove the styling completely. 

A random quote in the WordPress sidebar

To change the background color, text color, or background image, go to Quotes » Settings.

In the left menu, click on the Appearance tab.

How to style the random quote in your WordPress sidebar

You can now change the background color and text color, by clicking on the Select Color button.

This adds an area where you can choose your perfect color.

Changing the background color

If you change your mind, you can restore the plugin’s default colors at any point. Simply click on the Default button.

You can also change the background image. To remove the default background image, scroll to Background Image, and then click on the None button.

Customizing the quote's background image

You can also add your own background image.

Using your company or product logo as a background image can be a great way to brand your quotes.

Displaying a random branded quote in WordPress sidebar

To upload a new background image, click on the Custom button. This adds a Choose File button. 

Give this button a click. This will open a window where you can select the file that you want to use as your background image.

Uploading a new image to your random quote

After making your choice, you can customize how this image looks on your site.

This includes changing the background image alignment and the opacity, which is how transparent the background image is.

Why not experiment, to see what different effects you can create?

How to Add, Edit and Delete Quote Categories 

Sometimes, you may want Quotes and Tips to display a completely random quote.

Other times, you may need more control over the kind of quotes that it displays. 

You can do this using quote categories. We’ve already seen how to create a category when adding a new quote. However, Quotes and Tips has an entire menu where you can make changes to these categories, and create new ones.

To see these settings, go to Quotes » Quotes Categories

Editing your quote categories

Here, you can quickly and easily create quote categories. To add a new category, type a name for your category into the Name field.

By default this plugin creates each quote category as a parent category. 

Another option is to create a subcategory. For example, you might have an OptinMonster parent category, and then create subcategories for your different promotions, such as ‘OptinMonster summer sale’ and ‘OptinMonster holiday promotion.’ 

To create a quote subcategory, you’ll need to select a Parent Category.

Choosing the quote parent category

When you’re happy with your quote category, click on the blue Add New Quotes Category button. 

You can also edit any of the categories you created earlier. 

To edit a category, hover over it. Then, click on the Edit link when it appears.

Editing a quote category in the WordPress dashboard

This launches a new page where you can make changes to this category. This includes editing the category’s name, and choosing a new parent.

We hope this article helped you learn how to show random quotes in the WordPress sidebar. Next, you can see our guide on how to increase your blog traffic, or see our expert pick of the best social proof plugins for WordPress 

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

The post How to Show Random Quotes in Your WordPress Sidebar first appeared on WPBeginner.


December 20, 2022 at 01:16AM