WordPress – get currenct category slug on category page

WordPress_logo4

  To get the current category details e.g. slug or id on the category page, use the following code. this code will return category object- $category = get_category( get_query_var( “cat” ) ); $cat_id = $category->slug; //other properties //term_id, name, slug, term_group, term_taxonomy_id, taxonomy, description, parent, count, cat_ID, category_count, category_description, cat_name, category_nicename, category_parent

Read More

How to Install XAMPP and WordPress Locally on PC/Windows

Setting up XAMPP on your Windows machine is by far no easy feat, let me tell you! But once it’s installed, it’s a breeze to run and will save you a bunch of time if you need to run WordPress locally. In fact, you’ll forget it’s even there. Having a localhost environment is an essential part of my WordPress workflow – I couldn’t do my day job without it. I regularly set up new installs of WordPress to test and play with new versions of themes and plugins, and I…

Read More

WordPress: WordPress Auto login by username

Create a autologin.php page with following script and upload to word press root. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ini_set(‘display_errors’, 0); if(isset($_GET[“username”]) && $_GET[“username”]!=””) { require( dirname(__FILE__) . ‘/wp-load.php’ );  $user_login=$_GET[“username”];  $user = get_userdatabylogin($user_login); $user_id = $user->ID; wp_set_current_user($user_id, $user_login); wp_set_auth_cookie($user_id); do_action(‘wp_login’, $user_login); $current_user = wp_get_current_user(); header(“Location: http://www.yoursite.com/wp-admin/”); exit; //print_r($current_user); }

Read More