Website Tutorial Create a WordPress website with Hostinger!
Creating a WordPress website with Hostinger involves a few straightforward steps. Here’s a simplified guide to help you get started: 1. Choose a Hosting Plan First, visit Hostinger’s website and select a hosting plan that suits your needs. They offer various plans that include WordPress-specific options which can optimize performance. 2. Register a Domain Name…
Website Tutorial WordPress Add Login/Logout Links Using a Plugin
Add Login/Logout Links Using a Plugin One of the simplest ways to manage login/logout links is by using a plugin. Many plugins are designed specifically for this purpose. Here’s how you can do it: Install a Plugin: Go to your WordPress dashboard. Navigate to Plugins > Add New. Search for a plugin like “Login Logout…
Website Tutorial WordPress-How to create a Taxonomy?
Here is an example of registering a “people” taxonomy function people_init() { // create a new taxonomy register_taxonomy ( ‘people’, ‘post’, array( ‘label’ => _(‘people’), ‘rewrite’ => array(‘slug’ => ‘person’), ‘capabilities’ => array( ‘assign_terms’ => ‘edit_guides’, ‘edit_terms’ => ‘publish_guides’, ) ) ); } add_action(‘init’, ‘people_init’); Here is an example of adding the term John to…
Website Tutorial WordPress display articles by category
<?php $cat_query = new WP_Query(array( ‘cat’ => ‘2’ )); ?> <div id=”sitebar”> <ul class=”nav nav-pills nav-stacked nav-og”> <?php if ($cat_query->have_posts()) : while ($cat_query->have_posts()) : $cat_query->the_post(); ?> <li><a href=“<?php the_permalink() ?>” target=“_blank” title=“<?php the_title(); ?>”><?php the_title(); ?></a></li> <?php endwhile; ?> <?php endif; ?> </ul> </div>
Website Tutorial How to Display Total Views on WordPress Posts
How to Display Total Views on WordPress Posts Place the code in your functions.php file function getPostViews($postID){getPostViews(get_the_ID()); $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); return “0 View”; } return $count.’ Views’; } function setPostViews($postID) {setPostViews(get_the_ID()); $count_key = ‘post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID,…
Website Tutorial How to enable two-factor authentication on your WordPress website
Enabling two-factor authentication (2FA) on your WordPress website adds an extra layer of security by requiring a second form of verification beyond just a password. Here’s a step-by-step guide to set it up: Using a Plugin The easiest way to enable 2FA is by using a WordPress plugin. Here’s how: Log in to your WordPress…
Website Tutorial WordPress-How to list custom post-type?
Listing custom post types in WordPress involves a few steps, but it’s relatively straightforward. Here’s a general guide to help you get started: 1. Register Your Custom Post Type First, make sure you have a custom post type registered. You can register a custom post type by adding code to your theme’s functions.php file or…
Website Tutorial WordPress-How to show single post content in front-end?
WordPress-How to show single post content in front-end? <?php if(have_posts()) : while (have_posts()) : the_post(); the_title(); echo ‘<div class=”entry-content”>’; the_content(); if(get_post_meta($post->ID, ‘key-name’, true)){ echo get_post_meta($post->ID, ‘key-name’, true); } echo ‘</div>’; endwhile; endif; ?>
Website Tutorial WordPress Gravatar avatar cached locally
In order to improve the user experience, I thought of caching the commenter’s avatar locally. Most of the avatar files are in png format. I tried to delete all cached avatars and re-cache them. After refreshing, the avatars can be displayed normally. The following is the cached avatar code: function fa_cache_avatar($avatar, $id_or_email, $size, $default, $alt)…