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

How to write this conditional statement?

is_tag checks whether the page being displayed is the tag archive page for the named tag. It does not check whether the post in a Loop has that tag, which is what you ask: “…to show if the post has tag premium…”. For that you need has_tag if has_tag( ‘premium’ ){ ?> <a href=”https://wordpress.stackexchange.com/questions/125158/<?php the_permalink(); … Read more

Nested conditionals

If I understood you correctly: <?php //if home, do nothing if( ! is_home() || ! front_page() ) { //if has post thumbnail if( has_post_thumbnail() ) { the_post_thumbnail( ‘full’ ); echo ‘<h1 class=”entry-title”>’. get_the_title() .'</h1>’; } else { //no post thumbnail, show normal entry title echo ‘<h1 class=”entry-title”>’. get_the_title() .'</h1>’; } } or, it can be … Read more

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