Create Custom Widget

// Creating the widget class apbd_custom_widget extends WP_Widget { function __construct() { parent::__construct( // Base ID of your widget 'apbd_custom_widget', // Widget name will appear in UI __('apbd Custom Widget', 'apbd_widget_domain'), // Widget description...

Maintenance mode using function

function maintenace_mode() { if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {wp_die('Maintenance.');} } add_action('get_header', 'maintenace_mode');  

Add class to first post in WP loop

add_filter( 'post_class', 'apbd_first_post_class' ); function apbd_first_post_class( $classes ) { global $wp_query; if( 0 == $wp_query->current_post ) $classes[] = 'first-post'; return $classes; }...

How to Add Odd And Even Class to WordPress Posts

This is going to be an exciting article about WordPress post classes. You can use your own post classes to design a posts in specific order. Today I will show you how to add event and odd class to your posts. It’s super simple. Just add the following code...

Preventing Users From Accessing wp-admin

function jeba_blockusers_init() { if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { wp_redirect( home_url() ); exit; } add_action( 'init', 'jeba_blockusers_init' ); }...