If string too long then trim it Remove last # characters
All posts by
Auto Timestamp
To Auto Timestamp A Row Set row type as "timestamp" Default: CURRENT_TIMESTAMP On Update Current_Timestamp: checked if you want the timestamp to update when the row changed, not checked to only timewstamp it on creation. This is an equivalent in code: CREATED timestamp NOT NULL default '0000-00-00 00:00:00', UPDATED timestamp NOT NULL default now() on update now(), […]
Stopping zooming to desktop page
Mobile devices such as iPhones often need to be told not to zoom the whole page. There’s a good description here. Use this in the head to stop zooming occurring: <meta name=”viewport” content=”width=device-width, initial-scale=1″>
Import file into a string
Import an html file into a string trim(file_get_contents($_SERVER[‘DOCUMENT_ROOT’] . '/email_templates/membership_request_subject.htm'));
Number of posts, pages etc shown
Click ‘Screen Options’ to increase the number of posts or pages shown per page.
Width
Calculate width based on total width Width only as wide as needed for the text Min width needed to fit the content Min possible (move things under each other to minimise) Min needed without making thinner than normal
z-index
You many need to position: relative; to get a z-index value to be used correctly. Things with a high z-index beign hidden behind other elements with a lower z-index If you get problems ensure that if divs etc your high z-index element is withing within have a z-index specified, it is higher than the z-index […]
Responsive menu – Simple using only CSS
This is based on the excellent example here. If you get problems with the menu being hidden behind other screen elements below it, ensure that if whatever divs etc the menu is contained within have a z-index specified it is higher than the z-index of lower down screen elements. Although the drop menu specifies a […]
Add your own sidebar content
To add your own sidebar content without creating your own widget you can do the following: add_shortcode('MY_SIDEBAR_CONTENT', 'my_sidebar_content'); add_filter('widget_text', 'my_custom_text_widget_shortcodes'); function my_custom_text_widget_shortcodes($text){ ?> ADD YOUR CONTENT HERE <?php //To allow other text from the widget text box to be shown we need to strip out our shortcode and return what's left $text = str_replace('[MY_SIDEBAR_CONTENT]', '', […]
Paths to images etc
You can specify paths in relation to the site root directoy with a leading forward slash like this: background: url(/images/header_logo.png) no-repeat;