Restrict ability to edit pages by username

I striked for something a bit more complex, but similar in the core. The rather old-ish Role Scoper can do that, or you try the Premium version of its successor Press Permit. I befind both a bit complex if you only need a single usage option (manage page restrictions), but they work ;). Hope this … Read more

Redirect loop when forwarding to mobile site

You need to check that you aren’t already on the mobile site: function redirecting_to_mobile_site() { if ( $_SERVER[‘SERVER_NAME’] !== ‘m.example.com’ && wp_is_mobile() ) { wp_redirect( ‘http://m.example.com’ . $_SERVER[‘REQUEST_URI’], 301 ); exit; } } add_action( ‘template_redirect’, ‘redirecting_to_mobile_site’ ); You’ll need to clear your browser cache to properly test the fix.

Need to hide an element depending on date and post category

Drop this into the file that is displaying the date (assuming you are using get_the_date): $month = date( ‘F’ ); $categoryIds = array(); $bannedMonth=”September”; $bannedCategory = 13; $categoryArray = get_the_category(); foreach ( $categoryArray as $categoryObj ) { array_push( $categoryIds, $categoryObj->term_id ); } if ( $month != $bannedMonth && !in_array( $bannedCategory, $categoryIds ) ) { echo … Read more