hello everyone, again to the time of the random article, please use the mobile phone to open the demo site, and then shake the phone like a sister, you will find very good things, cool bar. This feature is already integrated in the Oconnor1.8. This article mainly explains the principle of the goods. First we need to download the Shake.js,shake.js GitHub address, we only need the inside of the shake.js, and then introduced. Add "Shake" event listener Window.addeventlistener (' Shake ', shakeeventdidoccur,false);//function to call when shake occursfunctionshakeeventdidoccur () {//put your own code here etc. if(Confirm ("Undo?") {}} to cancel the listener Window.removeeventlistener (' Shake ', shakeeventdidoccur,falserandom article implementation way JS code, of course, before this need to enter the Shake.js script Window.addeventlistener (' Shake ', shakeeventdidoccur,false);//function to call when shake occursfunctionshakeeventdidoccur () {jquery.post (Bigfa.ajaxurl, {action:' Random_post ', }, function(data) {Window.location.href=data; });} The following code is thrown into functions.php, and if you have added the code for the previous random article, there is no need for Wp_enqueue_script (' Key ',true); Wp_localize_script (' Key ', ' BIGFA ', Array ("Ajaxurl" = Admin_url (' admin-ajax.php '))) ; Add_action (' Wp_ajax_random_post ', ' bigfa_random_post '); Add_action (' Wp_ajax_nopriv_random_post ', ' bigfa_random_post ' );functionBigfa_random_post () {$posts= Get_posts (' Post_type=post&orderby=rand&numberposts=1 '); foreach ($posts as $post) {$link=Get_permalink ($post); } Echo $link; Exit;} Ok. Just shake it. Browser and device support scenarios for iOS Safari4.2.1(and above) Android4.0.3 (defaultbrowser) Opera Mobile (Android) BlackBerry PlayBook2.0Firefox forAndroidfirefoxos Devices