Skip to main content

Wordpress

What Is WordPress?

WordPress is an open-source content management system (CMS) written in PHP programming language and MySQL database.

WordPress is known as the most popular, easy-to-use and free CMS in the world.

WordPress is a usable and flexible platform for many types of websites. From using it to write personal blogs and portfolios to e-commerce sites, information portals, discussion forums and other great websites.

Why do use WordPress?

  • Simple and easy to use
  • Large user community and ready to support each other
  • Easy to customize and modify
  • Cost savings
  • Rich and diverse theme and plugin library
  • SEO optimized, friendly with search engines
  • Multi-language support
  • Able to run on many different web hosting and server services

Wordpress limitations

  • Security: Wordpress is a widely used open source platform, so it is also a target for hackers and spammers. Therefore, It needs frequent updating (source code, plugins, themes...) and implement more advanced security measures.
  • Data processing performance: WordPress can have difficulty handling large databases.

Achievements that WordPress has achieved

  • Worldwide, about 25 articles are published on websites using WordPress every second.
  • The number of websites made with WordPress accounts for more than 43% of the total number of websites in the world.
  • Among websites using 100% CMS source code, WordPress accounts for more than 62%.
  • The WordPress 6.0 release to date has reached more than 138 million downloads, accounting for 77% of the total number of websites using WordPress.
  • WordPress has been translated into 169 different languages, including a completely translated Vietnamese version.
  • In the WordPress.org library alone, there are more than 59,570 plugins and 11,730 themes.

Distinguish between WordPress.com and WordPress.org

WordPress.comWordPress.org
Is a platform that provides online website creation and management services.Is the official website of open-source WordPress, here you can download the WordPress installation.
Operating based on the hosted service model, you do not need to install WordPress on your server yourself.You must download the source code and install WordPress on your own server or third-party server hosting services.
Create a free website with the domain extension wordpress.com, for example: yourwebsite.wordpress.com. However, if you want to use your own domain name, you must pay to upgrade the service package.Buy the domain name yourself and install it to point the domain name to your hosting
Only themes and plugins supported by Wordpress.com can be used. If you want to use third-party themes and plugins, you have to pay.Use any theme and plugin you want
Website security is handled by WordPress.comYou are solely responsible for website security
Can't customize the source code, can't fully control the websiteCan freely customize the source code and fully control the website
The management, maintenance, and upgrading of the website will be done by WordPress.comPerform the management, maintenance, and upgrading yourself
No eCommerce featuresCan turn WordPress website into an online store.

Some terms in WordPress

Themes

A WordPress theme is a folder of many files that work together to create the design of the website. WordPress themes include template files, stylesheets, images, and sometimes even JavaScript files. WordPress themes help improve the look, layout, colors, and user experience of a website.

Changing the WordPress theme does not affect the content of the blog, page, users, or other information stored in the database. Basically, themes just change the way information is displayed to website visitors.

Files often included in a Wordpress Theme:

style.css
index.php
page.php
single.php
search.php
category.php
archive.php
screenshot.png
...

Child Theme

Child Theme in WordPress is a theme that inherits the functionality and interface of another theme (called Parent Theme). Child Themes are used to modify existing themes while maintaining the design and code.

Plugins

A WordPress plugin is one or more pieces of code added to the source code of a Wordpress website. Plugins are considered extensions of websites that help users add many diverse features to WordPress websites such as contact forms, SEO optimization, social network integration, creating online stores, and many more other functions.

Loop

Loop is an action repeated through a number of functions such as while, for, foreach... Loop in WordPress is a piece of code placed in a function while (mostly) queries inside the global variable $wp_query to get the value of posts in a certain post type.

<?php 
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//
// Post Content here
//
} // end while
} // end if
?>

Posts and Pages

Post Types is a term used to refer to the different types of content in a WordPress site.
There are 2 default Post Types in Wordpress:

  • Post to post types of newsletters/articles that you want to be classified by a certain category and automatically displayed on the website (news, articles...)
  • Page uses it as an introduction page for some information and is not regularly updated

Distinguish between Post and Page

    Post        Page    
Support category and tagYesNo
Support parent-child hierarchyNoYes
Template SupportNoYes
Display automatically on websiteYesNo
Show in RSS FeedYesNo

Archive

Archives make it easier for users to access all posts that have something in common. You can create an archive based on a date of publication, content type, or taxonomy.

In WordPress, the theme’s archive.php file defines how archives look like and what they output to the archive page. This file is one of the templates that WordPress uses to show content on the front-end.

Taxonomy

WordPress Taxonomy are WordPress tool that allow users to group content of the same type on the website together.

Default Taxonomy Types in WordPress:

  • Category: categorizes post content with the same topic
  • Tag: used to group related articles on the website, tag is a smaller group of topics or more detailed than category
  • Link_category: allows users to link categories on the website
  • Post_format: is a tool to classify content on the website according to specific formats: audio, images...

Custom Taxonomies are self-configured sections to classify (group) content according to more specific needs.

Hook

Hooks help us attach some functions (code) to execute the actions we want without having to touch anything in the core of WP.
Wordpress has 2 main types of Hooks: Action and Filter.

Action Hooks

Action is a PHP function written to perform a certain function.
Frequently used functions:

  • Adds a callback function to a filter hook:

    add_action( $hook, $function_to_add, $priority, $accepted_args );
  • Calls the callback functions that have been added to an action hook

    do_action( $hook_name, $arg )
  • Removes a callback function from an action hook

    remove_action( $hook, $function_to_remove, $priority,$accepted_args );
  • Checks if any action has been registered for a hook.

    has_action( $hook, $function_to_check );

👉 View more about Action Hooks

Filter Hook

Filter Hook is an anchor point declared in the source code of WordPress, plugin or theme, so that we can modify the PHP code there. Filter Hook will help users easily customize functions without changing the original core sourcecode.

Frequently used functions:

  • Adds a callback function to a filter hook.

    add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 )
  • Calls the callback functions that have been added to a filter hook.

    apply_filters( $hook_name, $value_to_filter, $args )
  • Removes a callback function from a filter hook.

    remove_filter( $hook_name, $function_to_remove, $priority )
  • Checks if any filter has been registered for a hook.

    has_filter( $hook_name, $function_to_check )

👉 View more about Filter Hooks

User Roles

User Role in WordPress determines access permission for users of the WordPress website.

  • Administrator: full permission to a website.
  • Editor: handles the content of a website.
  • Author: has full permission to their posts, can delete their posts even after publishing
  • Contributor: does not have permission to publish their post or page, needs to submit it to an admin for review.
  • Subscriber: Users who have subscribed to your site can log in and update their profile
  • Follower: can only read and comment on your posts
  • Viewer: can read and comment on a post

Template Hierarchy

WordPress uses query strings and searches down through the Template Hierarchy to determine which template file will be used to display the page.

If WordPress cannot find a template file with a matching name, it will skip to the next file in the hierarchy. If WordPress cannot find any matching template file, the theme’s index.php file will be used.

👉 See more about Template Hierarchy

References