CSS Mobile

CSS: Targeting iphone and ipad screens only

@media only screen and (max-width: 480px), only screen and (max-device-width: 480px), only screen and (device-width: 768px) {
.socialIcons, a#fdbk_tab{
display: none;
Targeting only the ipad:
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) { }
If you are trying to target only landscape or portrait orientation, try the following:
and (orientation:landscape), like this:
@media only screen and (device-width: 768px) and (orientation:portrait){
   /* Your rules here */
If you are using JS to further target orientation (portrait or landscape), you can try this:
	if (window.orientation == -90 || window.orientation == 90) {
		// document.querySelector('meta[name="viewport"]').content = "width=device-width, initial-scale=1.0";
		total_width = 1024;
alert('Landscape' + window.orientation);
	} else { // portrait mode
		// document.querySelector('meta[name="viewport"]').content = "width=device-width, initial-scale=0.7";
alert('Portrait' + window.orientation);
A hacky way to test for the ipad / iphone in js is to check if orientation has been set:
if(typeof(window.orientation) != "undefined") { /* Stuff that will only run on iphone / ipad */ }
PHP Wordpress

Worpress: useful codex commands

<?php get_cat_name( $cat_id ) ?> Get the category name if you have the id of it

<?php get_category_link( $category_id ); ?> Get the category permalink

PHP Wordpress

WordPress: produce new templates that can be used for new pages

Put them on your Themes directory, any php file that is there and includes the following header will be included in the drop-down menu for templates to choose from while creating a page:

<?php/*Template Name: Custom Feed*/


Javascript: check if a variable is undefined without producing an error

if(typeof(a) != “undefined”){}