Skip to content

Instantly share code, notes, and snippets.

@tahirtaous
tahirtaous / WordPress functions only for mobile users
Created January 25, 2015 14:30
This is a little-known built-in function of WordPress that detects whether a user is visiting on a mobile device or not and allows to display content accordingly. It is quite handy function for those willing to include a bit of code for only mobile users.//
// This code will show message only on mobile devices
// only mobile users will see this message
// Source: https://www.cms2cms.com/blog/6-useful-yet-relatively-unknown-wordpress-functions/
// Tested: WordPress 4.1 Jan 25 2015
<?php if( wp_is_mobile() ) : ?>
Visit our website on your desktop for a richer user experience
<?php endif ?>
@tahirtaous
tahirtaous / Hide Screen Options button WordPress dashboard
Last active October 8, 2018 12:46
hide screen Options and Help button from WordPress dashboard, useful when developing for clients
// hide screen options and Help Buttons from WordPress Dashboard
// tested WP 4.1 Jan 25 2015
// https://wordpress.org/support/topic/remove-items-from-screen-options
// paste this code to functions.php file
add_action( 'admin_head', 'remove_wordpress_cfields' );
function remove_wordpress_cfields() {
echo '<style>#screen-meta-links { display: none; }</style>';
}
@tahirtaous
tahirtaous / .htaccess
Last active August 29, 2015 14:14 — forked from ahmadawais/.htaccess
#addthese two lines in the root folder of your old domain inside .htaccess file
RewriteEngine on
RewriteRule (.*) http://newdomain.com/$1 [R=301,L]
@tahirtaous
tahirtaous / Add Custom CSS to Anchors links in WordPress
Last active May 1, 2024 14:25
How to Add Custom CSS Class Directly to Menu Item (Anchors) Links in WordPress Theme