Website Tutorial

Learn how to design a website, write your website copy, design your website graphics and more with this step-by-step tutorial.

Website Tutorial

WordPress next post / previous post on the same category

<?php $current_category=get_the_category(); $prev_post = get_previous_post($current_category,”); $next_post = get_next_post($current_category,”); ?> <div class=”previous_post_link fl”> <?php if (!empty( $prev_post )): ?> <a href=”<?php%20echo%20get_permalink(%20$prev_post->ID%20);%20?>”><?php echo get_the_post_thumbnail( $prev_post->ID, ”, ” ); ?></a> Pre: <a href=”<?php%20echo%20get_permalink(%20$prev_post->ID%20);%20?>”><?php echo $prev_post->post_title; ?></a> <?php endif; ?> </div> <div class=”next_post_link fr”>...
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...
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', )...
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...
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...
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...
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...