Skip to main content

Posts

Showing posts from December, 2017

How to Create Custom Post Types in WordPress without using Plugin

WordPress has many different content types. A single item of content is called a post, also post is a specific post type. All the post types are stored in the same database table (wp_posts) and differentiated by a column called post_type. By default, five post types are available in WordPress. Post (Post Type: ‘post’) Page (Post Type: ‘page’) Attachment (Post Type: ‘attachment’) Revision (Post Type: ‘revision’) Navigation menu (Post Type: ‘nav_menu_item’) Also, you can create new post types which are called Custom Post Types. A custom post type can be added to WordPress using register_post_type() function. It very simple and you don’t need to use any plugin for that, you can register your custom post types without using Plugin. In this article, we’ll show you how to create custom post types in WordPress. Also, you’ll know how to add taxonomy or category of custom post types in WordPress. WordPress custom post type helps you to divide up your website content in a more stru

The Transitioning Guide of WordPress.com to Self-Hosted WordPress

WordPress is one of the most flexible and versatile blogging platforms. It is considered as an ideal blogging platform for webmasters who are seeking to build their blogs in few minutes. But if you’re a newbie then you must be confused, which way to go WordPress.com or WordPress.org. And if you’re are a regular WordPress user then you must be wondering how to switch your Blog from WordPress.com to WordPress.org. Making a switch to WordPress.org can be intimating for users who aren’t as technically inclined. Therefore, keeping this is mind here is a comprehensive guide to help amateurs understand well about WordPress.com and WordPress.org and how a webmaster can move to self-hosted WordPress. WordPress.com vs. WordPress.org A Brief Explanation to WordPress.com WordPress.com is a free self-hosted website used for commercial purpose. It runs on an open source WordPress platform, which means your website will be free forever, but the user can pay to upgrade the site to achieve the speci

Add Featured Image to WordPress RSS Feed

In our earlier tutorial, we have shown you how to add featured image or thumbnail to WordPress post . But the featured image would not be automatically displayed in the RSS feed. A filter need to be added to display featured image in RSS feed. In this article, we’ll provide the simple way to add featured image to WordPress RSS feed. Using add_filter() with a simple function, you can easily include post thumbnail in RSS feeds. Open the theme’s function.php file and add the following code in this file. // display featured post thumbnails in WordPress rss feeds function add_post_thumbnail_in_rss_feeds($content){     global $post;     if(has_post_thumbnail($post->ID)){         $content = '<p>' . get_the_post_thumbnail($post->ID) . '</p>' . get_the_content();     }     return $content; } add_filter('the_excerpt_rss', 'add_post_thumbnail_in_rss_feeds'); add_filter('the_content_feed', 'add_post_thumbnail_in_rss_feeds'); Po

Guide to Create Custom Page Templates in WordPress

In WordPress, page templates are a specific type of template file that are used for a specific page or group of pages. A page template only applies to pages, not for other content types. The page templates are used to change the look and feel of the pages. If you want to make a page different from other pages, create a custom page template. This tutorial shows you how to create custom page templates that can be assigned to the pages from administrative panel. Custom page template allows you to make the different layout for different pages. Template Hierarchy of Page Templates in WordPress When the browser requests a page, WordPress selects which template will use to render this page. As per the WordPress Template Hierarchy, page template files are looked like the following order. Page Template – WordPress looks for a custom template assigned to the respective page. If found uses it otherwise move to the next hierarchy. page-{slug}.php – If a custom template is not found, Word

Why Should You Add Front-end Login Page in WordPress and How

Sending your WordPress website users to the default login page is fine when you’re running a site with just a handful of users. But, in case you’re running a membership site or other sites with large user base, making users access their profile page in the WordPress site’s admin panel via the default login page is something you should avoid. Wondering why? It’s a well-known fact that the WordPress login page appears to be bland and boring. No doubt, the login page serves as the central entry point for millions of WordPress sites worldwide. But what if your users don’t really need to access the dashboard? Well, users belonging to a membership site are not usually interested in accessing the WordPress admin dashboard (except when they need to create a post or perform edit operations). Thus, making those users open up the admin panel through the login page is likely going to prove bad for user experience. However, you can ensure to deliver an enhanced user experience (UX) by letting

WordPress – How to Display Breadcrumb without Plugin

Breadcrumbs are navigation links, used to display all the pages links leading from the homepage. Basically, it is placed at the top of the page and helps to backward navigation. In WordPress, breadcrumbs played an important role on the post page. Many WordPress plugins are available to adding breadcrumbs on your site. But we recommend you to use our simple code for display breadcrumb on your WordPress site. You can easily display breadcrumb on WordPress site without any plugin. In this tutorial, we’ll show you how to create and display breadcrumb in WordPress. Create Breadcrumbs: We’ve created a custom function called get_breadcrumb() to generate the breadcrumb links. You only need to add the get_breadcrumb() function code in functions.php file of the current theme. /**  * Generate breadcrumbs  * @author CodexWorld  * @authorURL www.codexworld.com  */ function get_breadcrumb() {     echo '<a href="'.home_url().'" rel="nofollow">Home<

WordPress – How to Display Most Popular Posts by Views

Displays the most viewed posts at the sidebar are very helpful for visitors to find out the most popular post of your site. This tutorial will show you the simple way to display the most popular posts by views without using any plugin. You can get the most popular posts using simple WordPress most viewed posts query. We’ll use the post Meta for storing the post views count. Using the stored Meta value, we’ll fetch the posts according to the views count. You need to modify only two files functions.php and single.php . After that, you can display the most popular posts using simple posts query. functions.php File Open the functions.php file of the activated theme and add the following code. setPostViews() function add or update the post meta with post_views_count meta key. /*  * Set post views count using post meta  */ function setPostViews($postID) {     $countKey = 'post_views_count';     $count = get_post_meta($postID, $countKey, true);     if($count==''){    

Add featured image or thumbnail to WordPress post

Featured image or post thumbnail is pretty useful for your WordPress site. Using this feature, you’ll be able to add the thumbnail to WordPress post. This article will explain about how to add featured image or post thumbnail in WordPress. All modern WordPress themes have already been embedded post thumbnail support. If you are a WordPress theme developer or want to build a custom theme, this tutorial will help you a lot for adding featured image support to your theme. Enable Featured Image and Set Thumbnail Size add_theme_support() function is used for enabling the featured image in WordPress. Using set_post_thumbnail_size() function, you can add the default featured image dimensions. Open the wp-content/themes/themeName/functions.php file and add the following code. /*  * Enable support for Post Thumbnails on posts and pages.  */ add_theme_support( 'post-thumbnails' ); //Set thumbnail dimensions set_post_thumbnail_size( 346, 230, true ); $width => Optional.

Speed up WordPress site instantly

In WordPress, lots of plugins are available and you can easily build a full-featured website with these plugins. These plugins and site’s theme include many JavaScript and CSS codes and it does affect your site speed. If your website takes the long time to load, most of the visitors can leave. According to the Google ranking algorithm, search ranking depends on site speed. So, the speed of your site influences the visitors and SEO. This WordPress optimization tutorial helps to speed up WordPress site and make WordPress faster instantly. Using two WordPress plugin, you can reduce site load time and improve speed. Follow our step by step guide mentioned below and load your site much faster. Before starting the optimization you can test website page speed. Some popular website speed testing sites are given below. Google Pagespeed Insights GTmetrix Pingdom Step 1: Install and configure W3 Total Cache Plugin W3 Total Cache is a popular WordPress plugin for easy Web Performance Optimization

MailChimp Integration in WordPress

Are you want to build the newsletter subscribers list and send your post updates to the subscribers? This tutorial will explain how can you manage your website subscribers with WordPress and MailChimp. MailChimp is one of the most popular email marketing service provider. Using MailChimp you can easily manage website subscribers and can send website updates via email to the subscribers. This tutorial helps you to integrate MailChimp with WordPress. Create MailChimp Account: To connect MailChimp with your WordPress site, you need a MailChimp account. Follow the below steps for creating a MailChimp account.  Go to the MailChimp website .  Create a free MailChimp account and you’ll receive an activation email.  You need to click on the activation link and complete some signup process.  After completed the signup process, you would be redirected to the MailChimp Dashboard. Create Subscriber List: Now you need to create a subscriber list.  Navigate to the Lists page through

How to add Facebook Page Plugin to WordPress

Facebook Page Plugin helps you to embed and promote Facebook Page on your website. Visitors can like and share your Facebook Page without leaving your site. Using of WordPress widget you can easily add Facebook Page Plugin to your website. You should need to place this FB Page widget at the sidebar of your website. This tutorial has divided by two steps. In the first step we will create the Facebook Page Plugin at the Facebook and second step helps to implement this FB page plugin in WordPress. Create Facebook Page Plugin  Go to the Facebook social plugin page and navigate to Social Plugins >> Page Plugin .  In this page you will find the configuration options for your Facebook Page Plugin. Into the Facebook Page URL input field enter your Facebook page URL. Plugin preview would be generated and also you can configure Plugin width, height and other options.  Once configuration is completed, click on the Get Code button. A popup would be appearing with the Plugin Code. P

Adding SSL and HTTPS in WordPress

Present days, SSL is important for every type of websites. It helps to make your website secure and earn the trust of your website’s visitors. Besides this, SSL certificate and HTTPS boosts your website ranking on various search engines. So, if you don’t have already added SSL to your website, it’s time to move from HTTP to HTTPS. Are you want to move from HTTP to HTTPS and install an SSL certificate in WordPress site? This step-by-step guide will make it easier to add SSL to website . In this tutorial, we will show you how to add SSL and HTTPS in WordPress . What are SSL and HTTPS? SSL (Secure Sockets Layer) creates an encrypted layer when data passed between two systems. Whether it is server to server or server to browser communication, SSL encrypts the data to make it secure. SSL and HTTPS both are used to protect the online data by creating a secure connection between browser and server. SSL – Transport Layer Security protocol that provides communications security over a network.

Create Custom WordPress Widget from Scratch

WordPress Widgets is used to add content and features to Sidebar. Some default widgets are come with the WordPress (Search, Categories, Tag Cloud etc.). We can also create custom widgets as per our needs. Today we will learn how to create custom WordPress widgets. For testing purpose we will create an Author Profile Widget. Author Widget would be used to display author information (Picture, Name, Introduction, Location, and Email) at the sidebar. Follow the step by step instructions given below.  Create a folder named widgets into the current theme directory.  Create a PHP file named author-widget.php .  Provide widget details under the comment tags (It is not mandatory). /**  * Plugin Name: Author Widget  * Plugin URI: create-custom-wordpress-widget-from-scratch  * Description: Provides a widget for display blog author information  * Version: 1.0  * Author: CodexWorld  * Author URI: http://www.codexworld.com  */  Using the add_action() function we will hook codexworld_author_widget(

WordPress – Adding custom fields to the post

WordPress has a way where developers can create custom fields to the post. With this way we can extend WordPress functionality and fulfill our requirement. This extra custom fields data is known as meta-data. Meta data allow you to add some additional data to the post. In this tutorial we will discuss how to create WordPress custom fields and insert some additional data to the post. This step by step tutorial provides you an easy way to add custom post meta box in WordPress. Now we will add a custom meta box into post adding page. Through this custom meta box we will insert the author name of post. Also we will display the author name of respective post at the post listing page or post details page. All the meta box related working will be done in theme’s functions.php file. So, open the functions.php file of current active theme and follow the below steps. Step 1: Adding Custom Meta Box add_meta_box() function is used to add meta boxes to the administrative interface. The below cod

Create a custom WordPress Plugin from scratch

WordPress is the most popular open source content management system for today’s world web application. WordPress Plugins allow easy modification, customization, and enhancement of a WordPress blog. A WordPress Plugin is a program, or a set of one or more functions, written in the PHP, that adds a specific set of features or services to the WordPress without changing the core programming of WordPress. In this tutorial we will describe the creation of a custom WordPress Plugin from the scratch. WordPress Developers can learn how to create custom WordPress Plugin. The following step by step tutorial has made the custom WordPress plugin development process very simple. You can easily create WordPress plugin with our tutorial. Let’s start the WordPress Plugin creation tutorial. 1) Plugin Directory Creation: Create a directory with your Plugin name.(Like : myPlugin/ ) myPlugin/ 2) Main Plugin File: In the Plugin directory ( myPlugin/ ) create a PHP file with the same name of the Plugin direc

WordPress Tutorial for Beginners – Installation & Setup

WordPress is an open source Content Management System and written in PHP. Easy to use and strong user interface makes WordPress the most popular blogging platform. This tutorial will provide you the step by step instructions on WordPress installation. You can perform a new and manual installation of WordPress site by the following tutorial. Step by step guide helps beginners to create a WordPress site quickly. Now we are going to download the latest WordPress version and install in localhost server. Step 1: Download WordPress Download the latest stable release of WordPress from the official download page . Once Download button is clicked, the installation package will start downloading automatically. Save the installation package in your computer and extract it in a new folder (for example, wordpress/ ). Now the folders and files structure would look like the below. Step 2: Upload WordPress Directory to the Server Move the wordpress/ directory at the localhost server for install WordP

Create Custom Shortcode in WordPress Post, Page and Plugin

WordPress introduced Shortcode API in version 2.5. Shortcode is a set of functions for creating macro codes. In our previous WordPress tutorial we have discussed about custom WordPress plugin creation. Now we will discuss how can you add extra functionality to your custom plugin. When a shortcode inserted into page or post, it is replaced with the other content. Means, we instruct WordPress to find the macro code under square brackets ([]) and replace it with the dynamic content. Shortcode is one of the most useful features in WordPress and you can use shortcode into post, page and plugin. The usage of shortcode is very easy and programming skills are not required. In this tutorial we will fetch recently added posts from the database and display using shortcode. Our shortcode will instruct how many post will be retrieved. Also it will be provide heading of the posts. A simple shortcode is look like this: [latestposts] Shortcode can be used with additional attributes as the following: [

Add Event to Calendar using jQuery, Ajax and PHP

In our first PHP event calendar tutorial, we had shown how to create an event calendar using jQuery, Ajax, and PHP . That tutorial provides the script for generating calendar and display events from the MySQL database on the respective date. In this second part of the PHP event calendar tutorial, we’ll show how to add events to the calendar using jQuery, Ajax, PHP & MySQL. Means we’ll extend our PHP event calendar script with add event functionality. Before you begin, we suggest you read the first part of PHP event calendar tutorial . It will help to understand our event calendar scripts. Build an event calendar using jQuery, Ajax and PHP Files structure of PHP Event Calendar would be the same as the first part. Here we’ll use the same scripts but the event adding code will be added. Open the functions.php file and make the following changes. Add addEvent case on switch-case in functions.php file. case 'addEvent': addEvent($_POST['date'],$_POST[