WordPress widget code

CMS has the advantage of automatically linking to content, making it easier and more varied to access articles.
The main examples are the list of recent tickets, "retold," tickets whose theme is close, and the tag cloud.
The code of this data is encapsulated in a PHP function that can be placed anywhere in the interface, on the sidebars, as a result of an article displayed on the home page, in the footer...
Knowing these codes allows you to customize the theme of your site or even create it entirely.

List of codes

Categories

<?php wp_list_categories('show_count=0&title_li=<h2>Categories</h2>'); ?>

The show_count parameter indicates whether the quantity of parts in each category is displayed or not.
Text will not be inserted after title_li= if the title is separate from the template.

Tag cloud

<?php wp_tag_cloud('smallest=8&largest=17&number=30'); ?> 

It can be seen that it is possible to determine the size of the smallest and largest wording, as well as their maximum number.

Recent articles

<?php wp_get_archives('type=postbypost&limit=10'); ?>

Search box

<?php include (TEMPLATEPATH . '/searchform.php'); ?>

The searchform.php file located in the theme directory determines the format of the search field. Its content varies depending on the topic .

Blogroll

  <?php wp_list_bookmarks('categorize=0&title_li='); ?>

Archives

<?php wp_get_archives('type=monthly'); ?>

Meta

<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>

RSS

<li>
<a href="<?php bloginfo('rss2_url'); ?>" 
   title="<?php _e('Syndicate this site using RSS'); ?>">
   <?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?>
</a>
</li>

Connected

The list of relative articles is not included in the Wordpress code, but comes from plugins, and there are several of them. See the best plugins for Wordpress.

Widgets

Widgets contain similar codes, but they are built into a specific positioning system. The advantage of widgets is that the webmaster can move interface elements by dragging and thus easily customize the theme.
The disadvantage is that these widgets can only be placed in sidebars.

If you select widgets, the above codes should be removed from the templates or ignored.

Conclusion

This list of codes does not include interface elements such as author, date, title, etc. All this comes from the composition of the pages and is viewed as part of the creation or change of the theme.

See also