Message box when accessed from iPad

use wp_enqueue_script() to add a js file. I’ve hooked wp_enqueue_scripts so I can check is_page() for a specific page. function ipad_alert() { if( preg_match(‘/ipad/i’,$_SERVER[‘HTTP_USER_AGENT’]) && is_page(7) ) { wp_enqueue_script(‘my_script’, get_bloginfo(‘template_directory’) . ‘/js/my_script.js’); } } add_action(‘wp_enqueue_scripts’,’ipad_alert’);

Date-Based Conditional Tag

Here is function I have for old posts: function is_old_post( $days = 14 ) { if( !is_single() ) return false; $id = get_the_ID(); $date = get_post_field( ‘post_date’, $id ); if( strtotime( $date ) < strtotime( “-{$days} days” ) ) return true; return false; } Not tested, but you can probably tweak condition to be something … Read more

Problems with my conditionals in single.php by category

Look at http://codex.wordpress.org/Function_Reference/in_category Example: <?php if ( in_category(‘rabbis-weekly-commentary’) ) : ?> <div id=”inner_header”> <img src=”http://www.ifcj.ca/ifcj_ca/images/elements/commentary_header.gif” border=”0″> … <?php elseif ( in_category(‘yaels-weekly-commentary’) ) : ?> <div id=”inner_header”> <img src=”http://www.ifcj.ca/ifcj_ca/images/elements/commentary_header.gif” border=”0″>

If else with shortcodes

This is rather a simple PHP question and almost off topic. You can simplify your code drastically: $metas = array ( ‘twitch’, ‘own3d’, ‘livestream’, ‘ustream’, ‘justin’ ); foreach ( $metas as $meta ) { $value = get_post_meta( $post->ID, $meta, TRUE ); if ( $value ) { echo do_shortcode(“[livestream type=”$meta” channel=”$value”]”); break; } } This will … Read more

Check IF single OR multiple custom data has been entered

Since you already using get_post_custom a slightly cleaner yet still dirty (php) way of doing it. $sermondata = get_post_custom($post->ID); if( isset($sermondata[‘sermon_audio’]) || isset($sermondata[‘sermon_video’]) || isset($sermondata[‘sermon_document’])) { ?> <div id=”downloads”> // rest of your echo output </div> <?php } ?> ps . Just make sure the value is not null, to be safe you can combine … Read more

Only on single post page

If you mean a single post, not a page then use the conditional tag is_single() and check for this, like: function demo_link() { if ( is_single() && in_category( ‘themes’ ) ) { // Some code #1 } else { // Some code #2 } } add_action( ‘thesis_hook_after_post_box’, ‘demo_link’ ); If you will use it on … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)