Ways to process xml in c. How to open an XML document - features of working with XML files

A shortcode is a very useful thing for a webmaster; a shortcode really simplifies the routine work of inserting the same type of information onto hundreds of pages on a website. At the same time, it is convenient to then MASSIVEly replace the information in the desired shortcode.


If you don’t know what a shortcode is yet, I’ll briefly explain. Let's imagine that you need to insert some code into an article, let it be a link:

10 Useful Shortcodes for WordPress

Let's imagine that you want to insert it into 10 articles in random places. In principle, it’s not difficult, we installed it. Now imagine that the link turned out to be broken and you need to replace it in 10 places? What if it's 100 pages? It will be difficult to do this manually, perhaps, but for many it is a difficult task.

Now imagine that you have a plugin with which you can create a short link for each code, like , which can be inserted directly into the text in editor mode, which is often much more convenient than in html mode.

Now, if you need to change the link, then you go to the admin panel of the plugin and change the link, and the code will automatically change on all pages of the site where our shortcode is located. You can create your own shortcode for each link, banner, script or image and manage this array from a single control center.

And if you have an online store, then this is an even more useful thing for you, since using woocommerce shortcodes you can massively change prices, exchange rates, product names and anything else. How can all this be accomplished?

There are many plugins in WordPress for creating shortcodes, but I didn’t like any of them: either everything is in English, sometimes too sophisticated, sometimes too little functional... But just the other day I read that the famous SEO blogger Vitaly Burgomistrov announced A free plugin for these purposes is sCode by mojWP.


Here is a short video on how this plugin works:

There’s no point in explaining anything else about his work; everything is very clear from the video. The only point I would like to clarify is how to insert a shortcode into a WordPress template?

If you insert a shortcode into the html code of the template, you will see what you inserted - the shortcode. To make it work, you need to enclose your shortcode in a function:

Now you will see on the site exactly what you are hiding behind your shortcode. Nothing complicated, right? In the admin panel there are small instructions for the plugin and a video that I inserted into the article.

I'd rather show you how it can be put into practice for . I've been wanting to do this for a long time and now it seems like the right time. To understand the essence of my idea, I will note only one point.

What does earnings from adsense depend on?

1. Cost per click.
2. Number of clicks.

We will no longer be able to influence the first if the article is written and there is already good traffic to it. But we can increase the click-through rate significantly. As you understand, I will only talk about the advertising blocks that are in the article. The blocks in the sidebar, in the footers, and especially in the header are the most stupid and I removed them all a long time ago.

But in the article it’s a completely different matter. A person starts reading an article and comes across an advertisement - will he click or not? Here everything depends on one factor: the topic of the advertisement COMPLETELY coincides with the issue that is being addressed at THIS stage of the article. Example:

Here is a person reading about which hosting to choose. He reads, reads, and comes to the question that you wrote in the article and highlighted it in bold - which hosting is best to choose?

By the way, I have already used this plugin and inserted a shortcode with adsense advertising after my question - what does it show? If you place the advertising block in a different place, then this effect will no longer exist. Do you understand what I'm getting at?

Yes, you need to MANUALLY insert the shortcode with advertising IN THE RIGHT PLACE! If this place does not exist, then it needs to be CREATE! You can do this: open google.com and enter the name of our article into the search. We look for our article in the search results and go to it. Let's look at what ads adsense displays. We look for a place in the article where it will belong, we complete the article using the words from this advertisement and insert the shortcode there.

Now the advertisement in the article will be MAXIMUM suited to its content, at least to the piece of text where it will appear. Yes, it’s long and tedious, but we’re not looking for easy ways, are we? The easy way is the religion of losers...


Didn't find the answer? Use the site search

Shortcodes in WordPress occupy a worthy place and allow you to expand the capabilities of your theme, but many developers do not use them due to lack of understanding or unwillingness to create high-quality themes.

For example, more than once I had to watch how unfortunate programmers put JavaScript or styles into WordPress posts even though they definitely don’t belong there. After all, there is a simple shortcode that can be added to the theme function file via add_shortcode and get clean and high-quality code.

Sometimes they try to argue that the styles or JavaScript are very different and you will have to create a lot of shortcodes - but this is not true, you can pass parameters to the shortcode and based on them make the desired JavaScript or write the necessary styles.

There are a lot of places to use shortcodes in WordPress: inserting a slider, form, price list, tables, JavaScript code, styles and much more. There are even more places where you need to insert a shortcode with a parameter :-).

Create a WordPress shortcode

The task of creating a shortcode in WordPress is not that difficult. To do this, you need to create a PHP function and write it to your theme file. For example, let's create a function myTxt and write it in functions.php:

function myTxt())(
$str="Title

Text description

";
return $str;
}

You also need to write this short code in function.php:

That's it, you have your own shortcode that can be inserted into the post like this:

WordPress shortcode with parameters

Now let’s complicate the task a little, let’s try to pass some variables from the post into our short code. Suppose you need to transfer information from a post to a WordPress shortcode through its parameters. In my example, I will have 2 shortcode parameters - this is the title and the description text that I want to display. Let's modernize our myTxt function like this:


$str="".$atts["title"]."

".$atts["txt"]."

";
return $str;
}

add_shortcode("myCodeInPost", "myTxt"); - leave it as it was, without changes

And in the post we write the following shortcode call:

If you noticed, we also have a $content variable - it is responsible for the text inside the shortcode. For example, if we want to display specific text, select it like this. Then we can modernize the shortcode this way:

function myTxt($atts, $content = null)(
$str="".$atts["title"]."";
$str="".$content.""
return $str;
}
add_shortcode("myCodeInPost", "myTxt");

We will call this shortcode with parameters like this: Text for modernization

All your shortcode with parameters is ready, you can use it for good measure.

How can you find out here.

WordPress is a powerful publishing system, equally convenient for novice bloggers and for creating any kind of forums, social networks, stores, etc.

Usually, an appropriate template is selected for each application, but sometimes its capabilities are not enough.

This is where shortcodes come to the rescue, with which you can add your own “zest” to WordPress.

A shortcode is a short code that is inserted directly into the text of a page, header, widget - that is, into the content and expands the capabilities of WordPress.

With its help, you can beautifully format the text, divide it into columns, insert content, a button, an audio player, an order form and many other features into the page that distinguish your WordPress from all others.

If there is no handler for a specific shortcode, then calling it on the page will look like regular text.

This article intentionally uses the names of non-existent shortcodes so that you can see what calling a shortcode looks like, and not the result of its operation.

Types of shortcodes by structure

They come without parameters, with parameters and with content.

Shortcodes without parameters

Sometimes you just need to call a shortcode to perform a strictly defined function. There is no need to pass any parameters to it.

For example, this code displays a horizontal line. Its appearance is determined in the style sheet.

This call displays the current year. Convenient for not having to edit texts every year.

Shortcodes with parameters

Sometimes you need to pass parameters to get different results.

For example, this is how a beautiful button is inserted, the style of which should be specified in the style sheet.

It contains two parameters: title is the label on the button, for example, Order, Subscribe, etc.

url is the click-through address.

This is how you can insert a price in rubles, which is automatically converted from the price in dollars at the current Central Bank exchange rate.

Here the parameter s is the price in dollars.

Shortcodes with content

They consist of two parts, between which there can be any content of a post, widget, etc.

This is how you can highlight a fragment of text or part of a post by “placing” a colored background under it:

There is some text that will be displayed on a colored background.

The color parameter sets the background color in the usual hexadecimal code.

And this is how you can display text in two columns of the same width:

A shortcode in PHP code consists of a function that processes it, and a command that assigns the corresponding function to the code.

Here's a typical shortcode for a button:

function ha_but ($atts,$content=NULL) (
extract(shortcode_atts(array(
‘title’ => ‘Go to’,
'url' => false
), $atts));

$output=" '.$title."’;

return $output;
}
add_shortcode('but','ha_but');

In this example, the function is named ha_but. It is passed two parameters - title and url. Moreover, the default value is assigned to title Go. If you skip the title parameter when calling the code, then the default button will read Go.

Inside a function, other functions can be called, files can be connected, etc. The functionality of the shortcode is limited only by your imagination and programming skills.

The function then returns the result of its work using return .

The add_shortcode function assigns a handler function called ha_but to the shortcode named but.

And here are the styles for a yellow button that spans the entire width of the page:

Btn(
display: inline-block;
color: #000000;
font: 300 16px “Roboto”, sans-serif;
text-transform: uppercase;
background: #fde42b;
background: -webkit-gradient(linear, left top, left bottom, from(#fcea38), to(#ffcf00));
background: -webkit-linear-gradient(top, #fcea38 0%, #ffcf00 100%);
background: linear-gradient(to bottom, #fcea38 0%, #ffcf00 100%);
border-bottom: 3px solid #b27d00;
padding: 14px 15px 11px;
width: 90%;
border-radius: 2px;
text-align: center;
text-decoration: none;
text-shadow: 1px 1px 0 #ffec89;

}
.btn:hover (
opacity: 1;
background: -webkit-gradient(linear, left bottom, left top, from(#ffdd02), to(#fffe6d));
background: -webkit-linear-gradient(bottom, #ffdd02 0%, #fffe6d 100%);
background: linear-gradient(to top, #ffdd02 0%, #fffe6d 100%);
border-color: #bd8500;

How to insert a shortcode into a WordPress template

You can insert a function - a shortcode handler - directly into the file responsible for outputting single posts - usually single.php . Then this shortcode will only work in posts.

It is better to insert it into the functions.php file, which is available in any WordPress theme. Then the shortcode will work on all pages, widgets, etc.

However, if you update or change the template, the shortcodes will no longer be processed. If you plan to change the blog design in the future, then it is better to place the code for all shortcodes in one file, for example, shortcodes.php, and place it in the my folder in the root of the site.

In this case, you need to organize the call by inserting the command require_once(‘my/shortcodes.php’) into the functions.php file.

After changing or updating your WordPress theme, do not forget to re-enter this command.

How to insert a shortcode into a WordPress page

For the shortcode to work, you need to insert its call into the desired place in the content, consisting of square brackets, the shortcode name and parameters. At the same time, you can design it in any style, just like regular post text.

I hope there are enough examples so that you can create your own WordPress shortcode that solves the problems you need.

Watch a video tutorial on creating more complex shortcodes here:

If you don’t know what WordPress shortcodes are, then let me clarify that these are codes that allow you to create various creative things using scripts and code. So that you don't have to insert bulky and awkward codes into your posts and pages, they are compressed into just one line - a shortcode.

In short, a shortcode is typically used to quickly call a long script or piece of code. While WordPress has its own set of shortcodes that can be used in your blog posts and pages, there are a large number of shortcodes out there that offer almost limitless possibilities.

Shortcodes can be inserted into a blog theme manually or through a plugin. The only problem is to find among the huge number of them exactly the one that suits you.

Don't worry, in this article, we will introduce 10 WordPress plugins that add functional shortcodes to your blog, as well as 10 codes that you can add yourself.

WordPress plugins

Here are some of the plugins that allow you to apply or customize WordPress shortcodes. Where appropriate, an alternative plugin is offered that does much the same thing.

1. Shortcode

A simple plugin that adds several useful shortcodes designed to display quantitative characteristics of your blog:

[ postcountbr ] - displays the total number of posts published in the blog;
[ catcountbr ] - displays the total number of categories that contain one or more entries;
[ tagcountbr ] - displays the total number of tags that are contained in one or more entries;
[ totalwords ] - displays the total number of words in published posts;
[ commentcount ] - displays the total number of approved comments;
[ PageCount ] - Displays the total number of pages published.

2. WordPress Shortcodes

This plugin includes over 20 WordPress shortcodes and a simple shortcode editor.

You can use it to add cool elements to your blog like:

  • SEO-ready tabs, buttons;
  • Author cards;
  • Message windows;
  • Smart links;
  • Sections;
  • Lists, etc.

You can even combine multiple built-in shortcodes to create unique elements such as a list of buttons or links.


Other options: There are two similar plugins - J Shortcodes and Arconix Shortcodes - which also include a set of useful shortcodes. For example, to create content and information panels, buttons, tabs, drop-down panels, radio buttons and much more. 3. Post Content Shortcodes

This plugin adds two shortcodes to your blog:

— allows you to display the contents of a single post or page inside another post or page. You must use an argument in the shortcode to specify the post ID. You can also use arguments to display a featured image, post snippet, and post title;

— displays a list of entries inside another entry. This shortcode also supports optional arguments for customizing lists: item ordering options, message types/statuses, image output, etc. You can even pull up a list of posts from another blog by adding the blog ID as an argument to the shortcode.

4. Shortcoder

The Shortcoder plugin allows you to create custom shortcodes through a visual editor. You can also store frequently used text, HTML, and JavaScript snippets.

The plugin has a built-in TinyMCE button that can be used in the blog editor to insert shortcodes. This will allow you to add your own shortcodes:


Other options: If you're looking for something similar, try the Shortcode Manager plugin, which allows you to create, manage, import, and export shortcodes. 5. Hide Broken Shortcodes

Sometimes, you may disable a shortcode, accidentally leaving out some of its functionality. Instead of going through every page or post to remove broken shortcodes, it will be easier to hide them. This plugin will help you do this.

Other options: Hide Unwanted Shortcodes is a similar plugin that makes broken shortcodes unavailable for viewing on the site. After this, you can edit the shortcode on the plugin settings page.

6. Column Shortcodes

If you want an easy way to create columns inside your posts and pages, this is the perfect shortcode plugin. Simply select the desired column width from the plugin's popup window and it will be added to the post editor.

There are 10 column sizes to choose from, ranging from one-sixth to the entire page width. You can also customize the padding of each individual column:

7. Metaphor Shortcodes

If you want to use a responsive column grid for your posts and pages, try the Metaphor Shortcodes plugin. With it, you can set certain parameters for columns such as spacing, start, end and classes.

This plugin also supports several other handy shortcodes, including:

  • Post Block Shortcode - displays the title and excerpt of any type of post anywhere on your blog;
  • Post Slider Shortcode - creates a horizontal slider for any type of post and displays it in the blog content;
  • Pricing Table Shortcode - Creates different types of pricing tables to display in your blog content.
8. ShortCodes UI

ShortCodes UI is another plugin for creating shortcodes that use native TinyMCE and Quicktag buttons. You can easily insert shortcodes into your posts and pages through visual and HTML editors.

This plugin is great for beginners who are new to codes; educational video tutorials are designed for them. Those who know a little more about codes will probably appreciate the color-coded syntax in the code editor.

Other options: My Shortcodes is a similar plugin with a beautiful interface that allows you to create your own shortcodes.

In the plugin's admin panel, you can manage, edit, enable/disable, and export elements and shortcodes. Live preview allows you to see what your shortcode looks like before you add it to a post or page.

9. Last Updated Shortcode

This is a very simple plugin that allows you to add the [LastUpdated] shortcode to your posts and pages. This feature will display the date and/or time of the last update.

There are also options to change the date/time display format.

10. Geoportail Shortcode

This plugin adds a Geoportail map to your posts and pages using a shortcode. After that, you can set the map size, scale, location (latitude and longitude), size (regular, mini), territory, layers and much more.

The map supports geotags (which can be connected via the Geolocation plugin) so that the blog displays the place where your posts were written (published).

The plugin also includes a shortcode builder to customize your map shortcode, as well as a preview feature that lets you preview your map before publishing it.

Shortcodes

There are also simple shortcodes that you can use on your blog - without having to install them through a plugin.

For each shortcode we will provide you with:

  • The body of the shortcode is a long piece of code that must be inserted into the theme functions file (functions.php) of your blog, insertion is done through the “Editor” available in the WordPress toolbar (Design > Editor);
  • Shortcode, which can be placed anywhere in your post or page, functionality is connected through it.

Some shortcodes may require additional customization (such as adding your personal Google AdSense code), so you'll still need some knowledge of editing codes.

Other shortcodes may have additional parameters that you can add, such as width and height. You can find out more by clicking the link for each shortcode.

Insert AdSense Ads

Inserts a Google AdSense ad block where you want it in your content.

Shortcode:

Code:

function adsense_shortcode($atts) ( extract(shortcode_atts(array("format" => "1",), $atts)); switch ($format) ( case 1: $ad = " "; break; ) return $ad ; ) add_shortcode("adsense", "adsense_shortcode");

Show Related Posts

Displays a list of similar posts above or below the page content.

Shortcode:

Code:

function related_posts_shortcode($atts) ( extract(shortcode_atts(array("limit" => "5",), $atts)); global $wpdb, $post, $table_prefix; if ($post->ID) ( $retval = "

    "; // Get tags $tags = wp_get_post_tags($post->ID); $tagsarray = array(); foreach ($tags as $tag) ( $tagsarray = $tag->term_id; ) $tagslist = implode(" ", $tagsarray); // Do the query $q = "SELECT p.*, count(tr.object_id) as count FROM $wpdb->term_taxonomy AS tt, $wpdb->term_relationships AS tr, $wpdb-> posts AS p WHERE tt.taxonomy ="post_tag" AND tt.term_taxonomy_id = tr.term_taxonomy_id AND tr.object_id = p.ID AND tt.term_id IN ($tagslist) AND p.ID != $post->ID AND p. post_status = "publish" AND p.post_date_gmt< NOW() GROUP BY tr.object_id ORDER BY count DESC, p.post_date_gmt DESC LIMIT $limit;"; $related = $wpdb->get_results($q); if ($related) ( foreach($related as $r) ( $retval .= "
  • post_title)."" href="".get_permalink($r->ID)."">".wptexturize($r->post_title)."
  • "; ) else ( $retval .= "
  • No related posts found
  • "; ) $retval .= "
"; return $retval; ) return; ) add_shortcode("related_posts", "related_posts_shortcode");

Insert PayPal Donation Link

Adds a PayPal button that allows users to conveniently make a donation.

Shortcode:

Code:

function donate_shortcode($atts, $content = null) ( global $post;extract(shortcode_atts(array("account" => "your-paypal-email-address", "for" => $post->post_title, "onHover " => "",, $atts)); if(emptyempty($content)) $content="Make A Donation"; return " "940", "height" => "300", "src" => ""), $atts)); return " "; ) add_shortcode("googlemap", "rockable_googlemap");

Display External Files

Inserts additional files such as text and images into your messages.

Shortcode:

Code:

function show_file_func($atts) ( extract(shortcode_atts(array("file" => ""), $atts)); if ($file!="") return @file_get_contents($file); ) add_shortcode("show_file" , "show_file_func");

Add A Login Form

WordPress shortcodes are a powerful but still little-known feature of the content management system. To show ads on your blog, simply type the word adsense. Using the post_count command you can instantly find out the number of posts. There are many similar examples. Feature sets can make a blogger's job much easier.

Example of a simple shortcode

A novice user needs to learn how to create and use special commands, as well as be able to use ready-made options. To do this, you need to understand what WordPress shortcodes consist of. As an example, you can take the line Some sentence. In this post, the user calls the option associated with the shortcode. The line consists of two parameters.

The first part of the entry is an array consisting of the id and color attributes. Instead of these values, you can specify any parameters with the desired names in the opening tag. The second part of the entry is text. In order to process it, you need to translate the entire record into PHP. The user will receive a line with the following content: my_shortcode(array("id"=>"1", "color"="white"), "Some sentence").

If you wish, you can use the post without the closing tag above. The line will look like this: . In this case, only the attributes listed in the opening tag are passed to the function. The specified recording option is used when calling an option that does not require receiving other information for processing. In order to add a gallery, just specify the ID in the attributes.

How to insert a shortcode in WordPress

The feature sets are very easy to use. The blogger needs to create a new post or open an existing post for editing. Then you need to switch the text editor to HTML mode and specify the code in . You can also use attributes. The entry will look like this: .

You can embed any content into shortcodes: text. WordPress 2.5 introduced a set of features called the Shortcode API. After saving the post, the content of the post is processed. In parallel, the Shortcode API converts shortcodes to perform their assigned functions.

Purpose

With this tool, you can create original WordPress themes in the editor without HTML or special knowledge. Accordion-style buttons and sliders are added if necessary. The user can divide the text into columns, connect a gallery, highlight words in any color, insert beautiful lists and tables with prices. Shortcodes allow you to make your blog more functional and your content more expressive and effective. This method of adding interactive elements is used to solve many problems and is very useful in work.

Creating shortcodes

If the user knows how to type a simple PHP function, then he will easily achieve his goal. To create a shortcode, you need to find and open one of the WordPress functions.php files. Then you need to insert the line function hello() (return "Hello, world!";). This action will create a function responsible for displaying the specified text. To transform it into a shortcode, you need to insert the add_shortcode() command after the hello() option.

The line will look like this: add_shortcode("hw", "hello");. Once a shortcode is created, the user can use it in notes and pages. To do this, you need to switch to HTML mode and enter the line . This shortcode is a clear example of how easy it is to create such feature sets.

Using Plugins

To make work easier, a blogger can download an extension. Using add-ons is the easiest way to get ready-made feature sets without unnecessary settings.

WP Shortcode by MyThemeShop

More recently, this free extension was distributed as a premium solution. Currently, the WordPress shortcode plugin contains 24 basic elements: buttons, maps, dividers, pricing tables, and much more. To get started, a blogger needs to install the add-on and open a text editor. To add a shortcode, you need to click on the “+” icon. The number of settings in the pop-up window that appears depends on the user's selection.

Shortcodes Ultimate

This is one of the most popular extensions. The add-on is found in every collection of plugins for customizing WordPress. The extension is available to every user. If necessary, paid additions to the plugin are downloaded. The blogger can work with 50 page design elements, a shortcode generator and a CSS style editor.

The plugin has support for several languages. The advantages of the software product also include integration with any templates, modern design, original design of buttons, the presence of a custom widget and sliders for the gallery.

Fruitful Shortcodes

This extension is visually quite simple. Software product updates are performed infrequently. However, the addon contains all the standard WordPress shortcodes.

The blogger can work with horizontal and vertical tabs, columns, dividers, etc. Added elements are instantly displayed in the graphic editor. The user can turn them off for posts or web pages using the Settings section.

Shortcoder

This plugin is also often found in different collections. The extension is updated very rarely. The user can create sets of functions using HTML and JavaScript codes. One of the simplest examples is placing an advertising block in the text. To do this, you need to create a set of adsenseAd functions.

The Shortcoder plugin is a very flexible tool. You won't be able to find basic shortcodes here. The user can create the necessary elements independently.

Easy Bootstrap Shortcode

The plugin allows you to add new design styles for the site. The developers claim that this is the simplest and most accessible extension in WordPress. The text editor panel contains buttons that allow you to copy and paste the shortcode. The plugin has support for fonts with icons. The user can add styles and other website design elements.

The extension was created to work with a web resource grid, so it has many settings for columns. A blogger can create several blocks, as well as specify sizes and indentations. The plugin supports the User can also work with basic shortcodes: tabs, lists, buttons, labels, sliders, etc.

WP Canvas - Shortcodes

The add-on contains a selection of the most popular feature sets to expand the functionality of the site. The blogger has access to not only ordinary elements, but also frames, images with inscriptions, blocks for adding reviews, countdown widgets, progress indicators with effects, etc.

The plugin supports custom styles, HTML code, fonts with icons. If desired, the blogger can enable the display of a selection of site posts on the page. The developers provided users with only a brief description of the software product. At the same time, the plugin copes well with all the functions assigned to it.

Arconix Shortcodes

The extension contains 6 types of WordPress shortcodes. The user can work with blocks, tabs, buttons, sliders, etc. The plugin supports fonts with icons. If desired, the blogger can change the login form, turn on the backlight, and divide the page into columns.

Simple Shortcodes

This is one of the simplest extensions for WordPress. After installing the software product, in the top panel of the text editor you can see a button for selecting various elements. All the standard shortcodes are here: tabs, dropdown lists, icons, notifications, etc.

After a blogger learns how to create and use feature sets, he can focus on ready-made solutions for the site.

WordPress Shortcodes: Setting Up

How to display a link for publishing a post on the Twitter social network? To do this, you need to open the functions.php file and paste the following line next to the other WordPress shortcodes in PHP: function twitt())(return "ID).""title="share the note with your friends!" >отправить";}add_shortcode("twitter", "twitt");.!}

Then you need to switch to HTML mode. Next you should enter the word. The link will be added to where the user left the shortcode.

Set of functions "subscribe to RSS"

One of the most effective ways to increase the number of subscribers is to display a well-formatted message. The blogger does not need to change the entire WordPress theme code. The user must decide for himself where the set of functions will be displayed. The code looks like this: function subscribeRss() (return "Subscribe";) add_shortcode("subscribe", "subscribeRss");.

Adding Google AdSense

Many bloggers use the contextual advertising service. Pasting Google's tool code into your theme file is easy. But marketers know that people are more likely to click on links embedded in content. To insert an ad block anywhere on the page, you need to create a shortcode and call it with the command.

Adding an RSS Feed

To accomplish this task, you need to convert the function into a shortcode. Then you need to enable HTML mode and insert the line into the editor field. The first attribute indicates the RSS feed URL, and the second attribute indicates the number of notes to display.

Adding posts from the database

To call up a list of articles directly in the editor, you need to create a shortcode, switch to HTML mode and insert the line . This command will list five posts from the category with ID 2. It is worth paying attention to the fact that WordPress plugins can display related posts. However, using a shortcode, a blogger can easily get a list of any number of posts from a particular category.

Calling up the picture of the last article

To make working with images easier, you can use function sets. To call up the image of the last post, you need to create a shortcode. Then you should enable HTML mode and insert the line into the edit field.

Adding feature sets to widgets

It is worth paying attention to the fact that not a single WordPress shortcode works in the side columns of the site. The platform limitation can be bypassed. To do this, you need to open the theme file for WordPress functions.php and insert the line add_filter('widget_text', 'do_shortcode');. The shortcode will be added to the widget.