WordPress Shortcodes - GreenGeeks https://www.greengeeks.com/tutorials/category/wordpress-shortcodes/ How-to Website Tutorials Tue, 13 Dec 2022 16:32:29 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.2 How to Search for and Replace Shortcodes in WordPress https://www.greengeeks.com/tutorials/search-replace-shortcodes-wordpress/ https://www.greengeeks.com/tutorials/search-replace-shortcodes-wordpress/#respond Mon, 09 Mar 2020 14:00:30 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=32911 Using shortcodes in WordPress is a very powerful tool. They allow you to accomplish a function from a plugin simply by displaying the code. However, …

How to Search for and Replace Shortcodes in WordPress Read More »

The post How to Search for and Replace Shortcodes in WordPress appeared first on GreenGeeks.

]]>
Using shortcodes in WordPress is a very powerful tool. They allow you to accomplish a function from a plugin simply by displaying the code. However, sometimes you need to remove or search and replace a shortcode. This can be tedious, especially if you don’t know where to look.

There are a couple of different ways to perform a shortcode search on your WordPress website. Of course, you can use a specific type of plugin that will make the process quick and easy. You can use code in your funtions.php file. However, this style is outdated and difficult. We will focus on plugin use in this tutorial.

Let’s take a look at how you can replace old shortcodes or delete them altogether.

What are Shortcodes?

If you have been using WordPress for a while, then you have definitely come across the term “shortcode.” They are a very helpful feature that WordPress uses to allow you to accomplish more complex things on a website.

Simply put, a shortcode is a small piece of code that you see when using some plugins in the back of your WordPress admin dashboard. The code is shown inside brackets that surround it. It will look something like this:

[this is a shortcode]

You can put it anywhere within WordPress posts, pages, and widget areas. The code will perform a specified function, depending on what plugin you are using and how it relates. For example, it may display a gallery, or a video, or something else related like category posts.

Shortcode Pros and Cons

It is true, shortcodes make life much easier when it comes to design. Set up a particular plugin in the back-end of your website, and then a generated shortcode will allow you to easily place your design or function into a post or page. This saves time and effort, and you don’t have to touch any type of PHP, CSS or HTML code.

However, it is still not recommended that you overuse shortcodes on your website. Too many shortcodes can be problematic, especially if your theme already comes equipped with a bunch of its own shortcodes.

If at all possible, it is ideal to keep shortcode use on a website under control. You can talk to a theme author or a plugin author and see if there are alternative ways to accomplish what you want to do.

This way, you won’t be constantly updated and replacing shortcodes that evolve fairly quickly over time. However, if you find yourself in that exact situation, then the plugin we are going over together below will take care of this for you quickly and easily.

Are Shortcodes Hard to Replace?

It’s not that shortcodes are hard to replace. It’s that unused shortcodes will stay on a page or post even if the plugin you were using has been deactivated and deleted.

This can become a problem over time if you have used a lot of different shortcodes in multiple places on your website. Oftentimes, shortcodes need to be updated or replaced. You may have forgotten all the places you put these codes and have a hard time locating them.

Furthermore, as stated above, whenever you delete a plugin that uses shortcodes, the shortcodes will still remain on your posts and pages. This doesn’t hurt your website, but it does make it awkward for your audience, as they see the codes displayed as part of the content. This can be confusing and unprofessional.

So how can you easily search and replace a shortcode in WordPress? Sure, you can go through all of your content and try to find unused shortcodes. However, this can take an enormous amount of time, and you are likely to still miss some.

Instead of doing that, you can perform a quick and easy shortcode search using a fantastic little plugin. This will save you a lot of time and give you peace of mind knowing that you performed a search and all relevant shortcodes were replaced or deleted.

Let’s take a quick look at the plugin in question.

Search and Replace

Search and replace plugin

The Search and Replace plugin is a simple, lightweight, straight-to-the-point plugin. Simply put, this plugin allows you to easily search and replace a shortcode on your website anywhere it is saved.

There is actually not much more to say about it. Once it is installed and activated, you will be able to easily search for shortcodes in your site’s content database and replace them with any text you want. Or, you can simply delete them.

Note: The plugin allows you to actually search and replace all types of content in posts and pages. However, we are going to use it in order to replace old shortcodes.

Let’s take a look at how to install and set the plugin up for use.

Install and Activate Search and Replace

In order to search and replace shortcodes, you first need to install and activate the plugin. You can do this by going to the Plugins page in your WordPress admin dashboard.

Install and activate the plugin to search and replace a shortcode

Once the plugin has been installed and activated, click on the “Search and Replace” menu tab. This is located on the left side menu of your WordPress admin dashboard.

Click on search and replace tab

This will take you to the main page for the plugin. Here you will be able to search and replace a shortcode quickly and easily. Let’s take a look at how to do it together.

Search and Replace a Shortcode

At this point, you should be on the main page of the plugin. There is no setup. However, this is where you will actually search and replace or delete all the shortcodes you need to.

There are two main sections. The top of the page has a simple search and replace box.

Search and replace box

The plugin is very easy to use. Simply put the shortcode that you want to replace in the “Search” field. Then, put the term or another shortcode you want to replace it within the “Replace by” field.

Be sure to click on either the posts or pages box to perform the search. Or you can click on both of them.

Fill out search and replace box

Now, click on the “Go” button to perform the operation. That’s it. Any shortcodes you have on your site from the search box will automatically be replaced by the term you chose.

Simply repeat that process until you have searched and replaced every shortcode needed on your website.

Note: The plugin does have a pro version. You can click on the link to view it and buy it should you feel that you need it. There will be more options available, which could make the process even faster. That being said, the free version of Search and Replace works great!

Final Thoughts

The use of shortcodes on a WordPress site is just one of the many great things that makes building with WordPress so unique, easy, and fun. However, it is still ideal to keep your use of shortcodes under control due to constant updating issues and possible theme and plugin conflicts.

If you do find yourself in a place where you have to try and search and replace a shortcode on your site, then the Search and Replace plugin is perfect for you.

Give the plugin a try. Did you find that searching for unused and outdated shortcodes was easy? Have you needed doing this in a different way?

The post How to Search for and Replace Shortcodes in WordPress appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/search-replace-shortcodes-wordpress/feed/ 0
How to Attach Reusable Code to Posts and Pages for WordPress https://www.greengeeks.com/tutorials/how-to-attach-reusable-code-to-posts-and-pages-for-wordpress/ https://www.greengeeks.com/tutorials/how-to-attach-reusable-code-to-posts-and-pages-for-wordpress/#respond Wed, 12 Sep 2018 15:00:43 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=19958 Looking for a way to easily add reusable snippets of code to your posts and pages in WordPress? This is actually an incredibly useful feature …

How to Attach Reusable Code to Posts and Pages for WordPress Read More »

The post How to Attach Reusable Code to Posts and Pages for WordPress appeared first on GreenGeeks.

]]>
Looking for a way to easily add reusable snippets of code to your posts and pages in WordPress? This is actually an incredibly useful feature to have especially if you include ad serving systems, affiliate banners or the same call to action in multiple locations.

Many of you will probably have a few Notepad files filled with coding elements you copy and paste directly into content. But there is a much easier way through the use of reusable post snippets in WordPress.

In this tutorial, I’ll show you how to attach reusable code to posts and pages with just a few clicks of the mouse. It’s a fast and much more efficient way to distribute certain additions within your content.

What are Some Examples of Reusable Code?

Perhaps one of the most common pieces of reusable code is in the form of Google AdSense. This is the ad serving network a lot of people will use on their websites to generate a bit of income. It can also be tedious to copy and paste this code into various areas of your post or page.

Affiliate banners and text links are among some of the most common code snippets as well, especially if you plan on using systems like Amazon to sell goods from your site.

Have that perfect call to action button you include in every post? Instead of copying the code you can just click a button or two without leaving the WordPress editor.

Video embeds, live streams, webinars and more into virtually any area of WordPress supporting text edits. This means you are also capable of adding reusable code in certain sidebar widgets.

Using Post Snippets

Today, I’ll quickly go over some of the things you can do with Post Snippets. This is a bit different than the content templates covered in the past. For one thing, Post Snippets won’t automatically add the HTML code for paragraphs like it does for TinyMCE Templates.

What about Global Content Blocks? This was a good plugin back in the day, and had a glowing review among thousands of users. Unfortunately, Global Content Blocks is no longer available from WordPress.org and hasn’t been updated in a couple of years.

Post Snippets work in a similar way to TinyMCE Templates in that you’re provided a shortcode to use for any element you add to the system. Simply select the snippet you want and WordPress adds the shortcode on its own.

You can also opt to add the code yourself instead of using the button within the visual editor.

Setting Up Post Snippets

Install and activate the “Post Snippets” plugin.

Install Post Snippets

A new message will appear asking for permission to share your data with the developer. This is optional and does not directly affect the use of the plugin. However, I’m simply going to click the “Skip” button to continue.

Skip

The next screen is the actual settings for the plugin. If at any time you need to find this section, it’s always located under Settings in WordPress.

Post Snippets Settings

Let’s create a new element to add to WordPress. Click the “Add New Snippet” button.

Add New Snippet

This will create a new “Untitled” snippet to use in your posts and pages. Click the down arrow on the right to expand the actual snippets field.

Expand Snippets

Change the title of the snippet by clicking the pencil icon. Name this something you’ll identify in the list when you’re creating content. This is used by the system to identify how the shortcode will work.

Change Snippet Title

Click the check mark to save your title.

Save Title

Input the snippet of code you want to reuse. In this example, I am going to insert an embed iFrame code I modified slightly from YouTube.

Insert Snippet

Click the “Shortcode” check box on the right. This is to keep things nice and organized within the post or page. If you leave this box blank, the code itself will display instead of the shortcode.

Shortcode Box

Input a description for the code. This is to further help you identify what this particular code does for you.

Snippet Description

Click the “Update Snippets” button on the bottom.

Update Snippets

Using Post Snippets

After creating the snippets you use most often, it’s time to place them into your posts and pages.

Click on any post or page you already have saved. You can also create a new post if you want to test Post Snippets out without interfering with text.

Solar Example

Place the cursor in the text where you want the snippet to show.

Place Cursor

Click the Post Snippets button from the visual editor.

Post Snippets Button

Click the snippet you want to use from the list. Since I only have one available, it’s the only one showing.

Choose Snippet

Click the “Insert” button on the bottom right.

Insert Snippet Button

The shortcode is automatically added to your post or page.

Snippet Shortcode

Save or update your post or page.

Update

The end result is your snippet appearing within the post or page.

Snippet On Page

Other Things You Can Do with this Plugin

Although it works beautifully to include various HTML coding elements, it can also serve to quickly implement combinations of things. For example, what if you use a specific link connected to a certain image while displaying a line of text? That entire setup is reusable text that is much easier to add to posts and pages with this plugin.

Using author boxes is a nice way to accredit a contributor. What if you coded one using HTML that fits your theme and layout perfectly? Post Snippets lets you plant the author box without extra plugins anywhere on the post or page.

Post Snippets delivers an incredible amount of flexibility for WordPress. You can even place other shortcodes within the snippet to trigger a series of specific tools or effects.

Maximize What You Can Do in WordPress

Reusable code is just one of many things you can customize in WordPress. Things like this make it easier to manage a site, add content or otherwise create an engaging layout. Explore your options and create something that connects with your visitors.

What codes do you find yourself copying and pasting into WordPress on a regular basis? How often do you use coded elements in your posts?

The post How to Attach Reusable Code to Posts and Pages for WordPress appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/how-to-attach-reusable-code-to-posts-and-pages-for-wordpress/feed/ 0
How to Create WordPress Columns without Using HTML https://www.greengeeks.com/tutorials/creating-wordpress-column-content-using-ultimate-shortcodes/ https://www.greengeeks.com/tutorials/creating-wordpress-column-content-using-ultimate-shortcodes/#respond Thu, 31 May 2018 14:00:09 +0000 https://www.greengeeks.com/tutorials/?post_type=ht_kb&p=18816 Do you want to enhance your WordPress content with columns? In the early days of WordPress, columns were added through HTML. While this is still …

How to Create WordPress Columns without Using HTML Read More »

The post How to Create WordPress Columns without Using HTML appeared first on GreenGeeks.

]]>
Do you want to enhance your WordPress content with columns? In the early days of WordPress, columns were added through HTML. While this is still a viable option and probably the best option to do so, nowadays most people will just add them using a plugin.

Luckily, there are a lot of great options to choose from. Today, I will demonstrate how to create column content in WordPress using the Shortcodes Ultimate plugin. I will also demonstrate how to use the Columns block in Gutenberg.

Why Should You Use WordPress Columns

Column content is more popular than you may realize. Most major websites utilize columns in their website’s design, but why is that?

The biggest advantage of column content is for comparisons. For example, let’s say you want to create a comparison article on two phones. It is quite normal to do a side by side comparison and to do that, you are going to need columns.

However, this isn’t just handy for writing content, it is extremely useful for online stores to utilize. For example, let’s say you have a product, but there are multiple versions for it. Most of the time stores will have a column for each version which lists what each one includes.

This helps customers pick out the version that is right for them.

Installing Shortcodes Ultimate

Shortcodes Ultimate is an extremely popular plugin with over 800,000 active installs. It has gained this popularity by offering a greater range of visual options to your website through shortcodes.

And of course, it also adds the columns shortcode.

To begin, click on Plugins and select the Add New option on the left-hand admin panel.

Add New

Search for Shortcodes Ultimate in the available search box. This will pull up additional plugins that you may find helpful.

Shortcodes Ultimate

Scroll down until you find the Shortcodes Ultimate plugin and click the “Install Now” button and activate the plugin for use.

Install Now

Using Shortcodes Ultimate for WordPress Columns

Shortcodes Ultimate works immediately upon activation. While there are no settings to configure, there is a section for the plugin.

Click on “[ ] Shortcodes” and select the Available Shortcodes option.

[ ] Shortcodes

Here you will find a full list of the shortcodes the plugin adds to your website.

Shortcode List

In total there are 67 shortcodes, with 15 being available in the premium version. Clicking on any option will provide you the shortcode and a detailed description of what it does.

In this case, I recommend clicking on Columns option to get all of the information you will need to use it.

WordPress Columns

You can find and example of the shortcode on this page and how it will appear. The shortcode is:[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ][su_row] [su_column size=”1/2″ center=”no” class=””]Column 1 Content[/su_column] [su_column size=”1/2″ center=”no” class=””]Column 2 Content[/su_column] [/su_row] [/ht_message]

While this may seem complicated, I assure you it isn’t. I’ll break it down for you. [ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ][su_row][/su_row][/ht_message] This part creates a row.

In between the row, you can add as many columns as you want. In this case there are two columns:[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ][su_column size=”1/2″ center=”no” class=””]Column 1 Content[/su_column] [su_column size=”1/2″ center=”no” class=””]Column 2 Content[/su_column][/ht_message]

Thus the shortcode as a whole creates 1 row with two columns. You may notice the column size is 1/2. This is the default value, but can be changed accordingly. The plugin provides a full list of sizes.

Column Sizes

Simply pick the number that matches your needs. You can add as many rows and columns as necessary. Simply insert the shortcode into a post or page and see it in action. The above example will look like this:

Column Example

Congratulations on adding columns with Shortcodes Ultimate.

Using Column Block in Gutenberg

If you do not want to add another plugin to your website, I have a solution.

The Gutenberg editor is block-based, and lo and behold, it has a Column block built-in. However, it is worth pointing out that your options are very limited. You can only have two columns, but it can be very useful.

Go to any page or post on your website and click on the “+” button.

+ Button

Type in “Columns” in the search bar and select the Columns block.

Columns Block

All that’s left is to add content to each column.

Column Content

This is a quick and easy way to add columns on the fly, but if you need more than 2 columns, you will need a plugin.

WordPress Columns Allow For More Content Options

Columns can be a great addition to the content you create in WordPress, but it is worth mentioning that there is a time and a place for them. If you are going to use a column, make sure the content you are using it on makes sense.

For example, it isn’t normal to write full paragraphs within each column. They are mostly used for bullet points, lists, and other similar things.

If it looks out of place, you probably shouldn’t have a column there. Luckily, columns have become a cinch to add to any website without coding.

Why are you using columns on your website? How many columns will you be using on a single page or post?

The post How to Create WordPress Columns without Using HTML appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/creating-wordpress-column-content-using-ultimate-shortcodes/feed/ 0
How to Avoid Using Shortcodes to Add a WordPress Button https://www.greengeeks.com/tutorials/how-to-avoid-using-shortcodes-to-add-a-wordpress-button/ https://www.greengeeks.com/tutorials/how-to-avoid-using-shortcodes-to-add-a-wordpress-button/#comments Wed, 17 May 2017 10:00:18 +0000 https://www.greengeeks.com/kb/?p=10467 Website buttons have potential to offer more of a sense of interaction for visitors. Instead of a plain and ordinary link to important pieces of …

How to Avoid Using Shortcodes to Add a WordPress Button Read More »

The post How to Avoid Using Shortcodes to Add a WordPress Button appeared first on GreenGeeks.

]]>
Website buttons have potential to offer more of a sense of interaction for visitors. Instead of a plain and ordinary link to important pieces of information, a button needs to be pressed. For many people, it’s almost an instinct to need to push a button – even if it’s not even labeled.

All fun aside, I’ve found buttons to be very effective when used the right way. Although shortcodes are a common method of distributing these small graphics, it can be tedious to remember code IDs for something like a call to action button.

So, what can you do when you don’t want to copy and paste snippets of code just to place a button? The answer is easy: use a WordPress plugin.

Today, I’m going to show you how to add a WordPress button without the use of shortcodes.

Why is adding buttons in WordPress important?

Buttons have potential to engage the visiting audience. Although you don’t want to overuse them throughout the content, they can still be quite helpful. For instance, call to action buttons in WordPress are more obvious to a visitor to click than a simple link. Which is why you see, “Order Now!” and similar graphics on most landing pages.

Because most people are using tablets and smartphones today, making sure they can tap links easily is important. After all, it can be such a pain to pinch-to-zoom each time you want to click something on a page. While it’s more of a cosmetic addition, it plays into the overall user experience.

And that’s what you’re trying to deliver. You want visitors to feel comfortable and enjoy browsing the website.

Adding Buttons in WordPress with a Plugin

One of the easiest methods to add a nice graphic for a link is by using the Forget About Shortcode Buttons plugin, or FASC. This tool is an easy-to-use method of creating visually appealing images to promote everything from downloads to mailing lists.

The best part is that it helps you create CSS buttons without requiring a single line of code form yourself.

To use this tool:

Go to the plugins area of WordPress and click the “Add New” button on the top.

FASC Add New Plugin

Search for “Forget About Shortcode Buttons” in the text box.

Search FASC

Install and activate the plugin. Once the plugin completes the install, a new function will be added to the Visual Editor of WordPress. This tool is available in both posts and pages making it useful regardless of the type of content you’re creating.

Install FASC

Create a new post. In the Visual Editor, find and click the icon for FASC. It will look like a box with an arrow pointing right.

Button For FASC

Change your properties. FASC gives you a few ways to customize the button. You can change the text, URL, colors, the type and size. FASC even has an option to open the link in a new window. Make your changes, but don’t click “Insert” just yet.

FASC Properties

Click the Icon link. These are small graphics that can be added to the text within the button. There are many to choose from and cover a wide scope of purposes. These are not necessary, but they do add more of a visual appeal depending on your design ideas. Plus, they make it easier for people to identify with the link.

Using the drop down box, you can select which of these icons to add. You can also choose whether to show the graphic before or after the text.

FASC Icons

Click the Templates link. In this area, you can store previously made buttons for future use. By clicking the small disk icon in the image, you can add the current graphic to the list.

Change the name of the template by clicking the pencil and then click the small check mark to the right. This will save the image for future use on other pages or posts.

FASC Template

Once you’re done creating the graphic, click the Insert button to put it into your content.

FASC Insert

You now have a new button ready for someone to tap or click.

New FASC Button

In this example, I created a call to action button in less than a minute. Although this one appears plain, FASC has the ability to help build more attractive designs by choosing the type of graphic you create. This WordPress button plugin comes with:

  • Flat – the basic graphic I used in this example.
  • Flat rounded – is a flat design with rounded corners.
  • Glossy – adds a reflective quality to the image, much like a metallic coating.
  • Glossy rounded – same as above with rounded corners.
  • Pop out – adds a drop shadow to the graphic making it appear like it’s hovering.
  • Pop out rounded – drop shadow with rounded corners.

Because FASC uses hexadecimal coding, you have thousands of colors to choose from. You can virtually create any color to match the scheme of the website perfectly.

One thing that stands out the most for me is the incredible number of icons that are available. In fact, there are also graphics to create custom buttons for some of the most popular social media sites like Facebook and Twitter. This can be a great addition to your strategies for integrating social media into the website.

If some of these icons look familiar, it’s because this plugin uses Dashicons and Font Awesome to add the images to CSS buttons. Unfortunately, there is no direct and easy way to add more of these micro-graphics until developers expand the list.

Other Plugins to Consider

While FASC is certainly one of the easiest to use, there are all kinds of ways to add buttons to your website. However, a large portion of them require the use of shortcodes. This isn’t a difficult process, but it means you’ll have to remember one more extra thing when creating content.

Here are a few plugins I found that let you create CSS buttons without investing much time in shortcode use.

Button Builder – Buttons X

Button Builder Plugin
Button Builder is a great tool for creating these graphics for your content. Although the Pro version comes with a wide breadth of options such as animations, it’s still a great tool. The biggest difference between this plugin and the one I featured today is that you can’t make buttons on the fly. Which means you need to create one before adding it to content. However, it comes with an incredible number of customization options.

Button Widget by Loomisoft

Button Widget Plugins
For those who are looking for a simple button to add to a sidebar, Button Widget has a lot of customizable features. It provides a method to add a link to the sidebar to engage visitors whether you’re creating it for social media or placing a call to action to buy a product. It comes with hover effects, border alterations and full text control. This could make a great addition to the FASC WordPress button plugin I featured above.

MaxButtons

Max Buttons Plugin
Like the one I mentioned above, this is another plugin that requires building the graphic before you start creating content. It, too, has an incredible number of customization options available. MaxButtons includes text control, gradients, borders and even containers. This plugin also comes with a variety of social templates including automatic counters as well as importing your own imagery, and this is all from the free version.

Buttons give visitors a larger interface to interact with the content. Given how a large portion of your visitors will be on mobile devices, this makes the interactions much easier. Remember, it’s all about delivering a great user experience that will dictate whether or not a person will return to the website.

What kind of buttons do you have on your site? Do you have good strategies to promote call to actions within your content, even if it’s just to comment on your post?

The post How to Avoid Using Shortcodes to Add a WordPress Button appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/how-to-avoid-using-shortcodes-to-add-a-wordpress-button/feed/ 1
How to Set WordPress to List Category Posts with Shortcodes https://www.greengeeks.com/tutorials/how-to-set-wordpress-to-list-category-posts-with-shortcodes/ https://www.greengeeks.com/tutorials/how-to-set-wordpress-to-list-category-posts-with-shortcodes/#comments Tue, 07 Mar 2017 15:00:00 +0000 https://www.greengeeks.com/kb/?p=9788 Websites continue to get bigger and bigger, which makes sorting features like taxonomies more useful than ever. If you want to make it easy for …

How to Set WordPress to List Category Posts with Shortcodes Read More »

The post How to Set WordPress to List Category Posts with Shortcodes appeared first on GreenGeeks.

]]>
Websites continue to get bigger and bigger, which makes sorting features like taxonomies more useful than ever. If you want to make it easy for visitors to find relevant content, list category posts so they can find similar topics.

The good news is that it’s extremely easy to do this by using some simple shortcodes. This means you can add the category list anywhere on a post, page, or even a widget. It’s robust and easy to use.

Today, I will demonstrate how to do this by using the List Category Posts plugin.

Why List Category Posts in WordPress?

Every website’s goal is to retain its visitors for as long as possible. However, when a visitor finishes reading a post, they tend to leave the website.

A list of category posts is a great way to direct a visitor to another post in that same category. It allows you to display similar content on that post or page. Many popular blogs and news outlets will display similar posts at the bottom of an article.

This ensures that if a visitor finishes reading the current post, they will be directed to a new one. If everything goes right, they will stay on your website and read another article. It’s simple in practice, but highly effective.

The same approach works for products in stores. For example, if you view a product on Amazon, you will typically see similar products that you can view. Thus, it’s a highly effective technique regardless of your website type.

And as you are about to see, it’s really easy to implement in WordPress.

How to List Category Posts in WordPress

Step 1: Install List Category Posts

The List category posts plugin is a simple tool that adds a custom shortcode to your website. The Shortcode can be added to any post, page, or widget in WordPress, and the only modification you need to make is the category you are displaying.

Of course, while the premise of the plugin is simple, there is plenty of room for customization. You can add custom CSS to change the appearance of what the shortcode displays. For additional information, check out the plugin page.

Let’s begin by installing the plugin.

Click on Plugins and select the Add New option on the left-hand admin panel.

Add New Plugin

Search for List Category Posts in the available search box. This will pull up additional plugins that you may find helpful.

Search for List Category Posts

Scroll down until you find the List Category Posts plugin and click on the “Install Now” button and activate the plugin for use.

Install List Category Posts

Step 2: Customize the Settings

Now, you could start adding shortcodes immediately after activating the plugin, but before doing that, I recommend taking a look at the plugin settings page. There isn’t much to it, but it gives you a lot of control over what you display to visitors.

On the left-hand admin panel, click on Settings and select the List Category Posts option.

List Category Posts Settings

Here, you will find four settings you can configure. At the top, you can choose how many posts to display when using the shortcode. This is very important because displaying a lot of posts takes up a lot of space.

By default, it is set to 10, but feel free to change it to whatever value suits you best.

Below this, you will find options for pagination and how to order the posts that appear. Again, just pick the best options for your site.

Customizethe plugin settings

It’s important that I mention that all of these settings can be included in the shortcode. However, doing so may make it harder to use for beginners. For this reason, using the settings page is a better option for most.

Click on the “Save Changes” button when you are ready to continue.

Step 3: List Your Category Posts

You are ready to begin using the plugin. As a reminder, the plugin focuses on shortcodes. They can be customized to fit your needs, and for all the variations, refer to the plugin documentation.

This tutorial will focus on the basics to help keep it as simple as possible. So let’s start with the core shortcode:

[catlist]

This shortcode will display the latest posts on your website regardless of category. The number of posts it displays is determined by the settings you chose in the previous step (10 is the default value).

Now, our goal is to display posts from a specific category, so we need to change the shortcode. Thus, the shortcode we want to use will be:

[catlist name=Dogs]

This shortcode will display the latest posts found within the category “Dogs.” You can change “Dogs” to any category on your website and those will be the posts that are displayed.

Now that we know what the plugin can do, all that’s really left is to actually use it. Go to any post, page, or widget where you want to display the category post list. Once there, paste the above shortcode with the category you wish to display.

Save the changes and you can view the list on your website.

View the List of Category Posts

There’s a lot more you can do with the shortcodes, but this really covers the basics of the plugin. As you can see in the above example, it will just list posts by title. So try to make sure they are interesting.

Congratulations on learning how to use the List Category Posts plugin in WordPress!

Don’t Limit Yourself To Categories, Try These Ideas

The plugin I used for this tutorial is full of all kinds of customizing options. From basic content links to more elaborate functions, you can set up a page for specific types of content to make browsing easier for visitors.

Here are just a few ideas that you may find interesting:

Creating Internal Links

Using this shortcode to display additional content helps the site by creating internal links. Visitors are able to find more content easier that is relevant to the current topic. This is especially useful if you display posts according to tags and specific categories.

Because the code will pull the most recent pieces by default, these links will always be up-to-date.

Showing Author Pride

As websites grow, it’s very common to expand the number of authors present. This ensures you can get more content out, and sometimes readers prefer one author over another. You can take advantage of this by using the shortcode to display posts by a specific author.

It’s a great way to capitalize on a popular author’s content, but this won’t apply to every site.

Faster Way to Show Content

If you set up the shortcode with your specific settings, such as using “numberposts” or “thumbnail=yes,” these can get quite long. Instead of typing them out every time, why not save them as a template in a Notepad file or some other note-taking plugin for WordPress?

This makes it easy to find the shortcode you want to use without having to actually remember the string of characters. Simply copy and paste it into your post, page, or sidebar.

Keep Visitors Engaged by Delivering Content They Want

The simple truth is that most visitors go to a website for a specific type of content. For instance, you probably go to a specific website or content creator to find video game reviews, but use another website to view their trailer.

That’s normal behavior in 2022, and that’s a problem for many websites as they try very hard to retain those visitors. Displaying related content by category is a great way to keep them engaged.

After all, if they enjoyed the content you produced enough to read it all the way to the end, they will likely want to read another.

Simple, but effective.

How often do you use shortcodes to add functionality to a post or page? What kind of shortcodes do you use in your projects?

The post How to Set WordPress to List Category Posts with Shortcodes appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/how-to-set-wordpress-to-list-category-posts-with-shortcodes/feed/ 2
What Are Shortcodes In WordPress? https://www.greengeeks.com/tutorials/what-are-shortcodes-in-wordpress/ https://www.greengeeks.com/tutorials/what-are-shortcodes-in-wordpress/#comments Tue, 26 Jan 2016 15:00:15 +0000 https://www.greengeeks.com/kb/?p=6528 WordPress is one of the most accessible CMS on the market, which has led it to also be the most popular option. While you never …

What Are Shortcodes In WordPress? Read More »

The post What Are Shortcodes In WordPress? appeared first on GreenGeeks.

]]>
WordPress is one of the most accessible CMS on the market, which has led it to also be the most popular option. While you never have to write full lines of code, there may be times where you need to use shortcodes in WordPress.

The good news is that shortcodes are very simple to use, and in most cases, just lines of code that you need to copy and paste into a shortcode block. That’s right, you really don’t have to understand how the code works, you just need to know what it does and decide on placement.

Today, I will explain what shortcodes are and how to use them in WordPress.

What Is A Shortcode?

A shortcode is a short line of code surrounded by brackets that adds a specific feature into WordPress. The full code is located in the backend of your website, and the shortcode is what triggers its activation.

Thus, instead of having to add several lines of something like HTML, PHP, or CSS to every post or page you wish to use it on, you simply need to add one line, then WordPress can load the full code.

Now you may be wondering how the full code gets there. Well, there are three ways. The first is that most themes have a selection of default shortcodes that are present, and many of them are unique to the theme.

The second method is that a plugin will add the code upon installation. In some cases, that’s all a plugin will actually do.

And lastly, it is possible to manually write the code yourself, but this is for users with coding knowledge.

The good news is that most themes and plugins have a full list of shortcodes you can use on their respective pages. Thus, 99% of the time, you are just copying and pasting the shortcodes you want to use in WordPress.

That said, some shortcodes can and need to be customized, but there are often examples to help you.

What Are the Default Shortcodes in WordPress?

The base WordPress install comes with a variety of shortcodes ready to use after installation. Some themes have more choices, but I will only list the default options and what they do.

  • [caption] [/caption] – Enables users to insert captions around the desired content.
  • [gallery] [/gallery] – Allows users to add an image gallery.
  • [audio] [/audio] – Users can embed an audio file directly into a post or page.
  • [video] [/video] – Users can embed a video file directly into a post or page.
  • [playlist] [/playlist] – Allows users to create a playlist for both video and audio content.
  • [embed] [/embed] – Users can customize the dimensions of embeded content such as videos, images, or audio.

You might have already noticed that all of these default shortcodes also have a default block that is far more common. That said, these are a great starting point when you want to learn how shortcodes work in WordPress.

WordPress even provides dedicated pages to explain how each of these shortcodes works, how to customize the shortcode, and multiple examples. You can find all of that in the WordPress Codex.

Note: If you want to know how to use a specific shortcode for a plugin or theme, the process is identical. Just remember to consult that plugin or theme to find out how to customize the shortcode, as each one is unique.

How to Use A Shortcode in WordPress

Step 1: Understand the Shortcode

Most people will completely ignore this step, but I think it’s worth pointing out. Every plugin or theme that adds a shortcode will provide the necessary information to use it. That makes your life much easier.

In many cases, plugins will add very basic shortcodes that just require you to copy and paste a single line of text. In other cases, they will create new pages that solely consist of that specific shortcode. These are simple cases.

The problem is when a shortcode can be customized. This isn’t a bad thing, and understanding how to do it is how you can master using shortcodes.

For instance, let’s take a look at the [Embed] function.

The most basic form of this shortcode will look like this:


That will just embed the content as it is. However, most users will want to, at the very least, set the size of what they are embedding. To do that, the shortcode will now look like this:


The important takeaway is that you can customize a shortcode, but how you do it depends on the shortcode itself. There is not a one size fits all explanation when it comes to making specific changes.

They can be very different from one another, which is why you must consult the source of the shortcode you want to use.

Step 2: Add the Shortcode to WordPress

The good news is that adding shortcodes is really easy in WordPress. You can add them in a post, page, or text widget. Regardless of what you choose, the method is identical.

Just keep in mind the size difference when choosing a widget.

Note: If you are still using the Classic editor, the process is even easier. Instead of needing to add a block, you can paste the shortcode directly into the visual editor. There’s really nothing to it.

First, go to any post or page on your website. Once there, add a Shortcode block.

Now, just paste the shortcode into the shortcode block.

That’s really all there is to adding shortcodes in WordPress. Just keep in mind that you will not see the output or result of the shortcode in the editor. To actually see it, use the “Preview” button or save the changes and view it on a live page.

Do Shortcodes Affect Page Speed in WordPress?

You may be wondering if shortcodes will have an impact on loading times, and the answer is, yes…to an extent.

In about 99% of cases, we are talking about an impact of a millisecond, which is negligible for most sites. The real problem comes from two scenarios: using multiple shortcodes on a single page, and using shortcodes that need to contact a third-party server.

Every time you use a shortcode, WordPress must locate the shortcode handler on the backend. It’s really not noticeable for a single instance. Now, let’s say you decide to use 10+ shortcodes on a page. Well, then you might notice a slowdown.

This is why you should only use shortcodes when necessary to avoid making your site work too hard for each visitor.

The other scenario is when a shortcode connects to a third party. This means your website has to connect with that third-party server to get the required information. A great example of this is Google Maps.

Google Maps is a great addition to any website, but the map could mean extra loading time. After all, it needs to connect with Google to pull the information to your pages. And when you combine this with using multiple shortcodes, well, your pages will take a bit longer to load.

Shortcodes Are Your Best Friend in WordPress

Many beginners try to avoid shortcodes as much as possible, but the truth is once you learn how to use them, they can really help speed up content creation. And many plugins rely exclusively on shortcodes to work.

Thus, sometimes you really don’t have another option. The good news is that they are easy to add, and in most cases, it just boils down to copying and pasting the right shortcode.

How often do you use shortcodes? Do you find yourself customizing the shortcodes, or just using the default option?

The post What Are Shortcodes In WordPress? appeared first on GreenGeeks.

]]>
https://www.greengeeks.com/tutorials/what-are-shortcodes-in-wordpress/feed/ 1