Connect to a Second Database on WordPress and Display Results from It

Let’s suppose you need to connect to a second database on WordPress. The snippet bellow will do it. ?Download download1.txt1 2 3 <?php $secdb = new wpdb(‘secondusername’,’secondpassword’,’seconddatabasename’,’secondhost’); ?> Also you may check this snippet, which will allow you to display a simple result set from the second database. ?Download download2.txt1 2 3 4 5 6 […]

Displaying WordPress Menus Wherever You Want on Your Theme

This is a basic and useful tip a job mate asked me another day. Step 1: copy the snippet 1 and paste it on your functions.php ?Download download1.txt1 2 3 4 5 6 add_action( ‘init’, ‘register_my_menus’ ); function register_my_menus() { register_nav_menus( array(‘top-menu’ => __( ‘Top Menu’ )) ); } Step 2: create your menu on […]

WCCTM PRO and WCCTM, Cool Plugins to Build WooCommerce Product Categories Menus

Hi folks! I’m proud to tell you, I’ve released the plugin I’ve been talking about with some WpWorking Blog readers. There’s a free version of WCCTM(WooCommerce Categories Menu):  And the WCCTM PRO version, with a lot of extra features. Let’s take a better look on it: WCCTM PRO is the amazing PRO version for WCCTM WordPress plugin, […]

Enabling Login by Email on WordPress

Enabling login by email on WordPress is very easy. All you have to do is copy the snippet bellow and paste it on your functions.php ?Download download1.txt1 2 3 4 5 6 7 8 9 10 add_filter(‘authenticate’,’wpw_emaillogin’,20,3); function wpw_emaillogin($user,$username,$password){ if(is_email($username)){ $user = get_user_by_email($username); if ($user){ $username = $user->user_login; } } return wp_authenticate_username_password(null,$username,$password); }

Redirecting After Login on WordPress Depending on User’s Role

This snippet will be useful for redirecting after login on WordPress depending on user’s role. Just put it on your functions.php ?Download download1.txt1 2 3 4 5 6 7 8 9 10 11 function redirusr($user_login, $user) { $usrctx = get_userdatabylogin($user_login); if(in_array("theroleyouwant",$usrctx->roles)){ ?> <script> window.location="<?php echo home_url("/");?>theslugyouwant"; </script> <?php } } add_action(‘wp_login’, ‘redirusr’);

WooCommerce, How To List Product Categories(With Thumbnails) and Subcategories

IMPORTANT UPDATE! Check out WCCTM PRO, a plugin that provides custom toggle, list and select field menus based on Woocomerce Product Categories. This code snippet may help you to list product categories and subcategories on your blog or website. This code snippet may help you to list product categories and subcategories on your blog or […]

online casino
worldbookies