• I have a site that uses a child theme of twenty twelve and I’m trying to make it more mobile-friendly by removing sidebars, changing menus, and using a better header image.

    I found a conditional tag http://codex.wordpress.org/Function_Reference/wp_is_mobile and I’ve used it to make the changes to my theme’s pages.

    The problem is that it only seems to work some of the time. Am I doing this right?

    Here’s an example:

    <?php if (wp_is_mobile() ) : ?>
    
                    <?php $header_image = get_header_image();
    		if ( ! empty( $header_image ) ) : ?>
    			<a href="http://www.bayarearealestatetrends.com"><img src="http://www.bayarearealestatetrends.com/wp-content/uploads/2013/01/logobaymobile.png" style="width:90%"></a>
    <?php endif; ?>
    <?php else : ?>
    
    		<?php $header_image = get_header_image();
    		if ( ! empty( $header_image ) ) : ?>
    			<a href="<?php echo esc_url( home_url( '/' ) ); ?>" style="background:#333; shadow-box:0px"><img src="<?php echo esc_url( $header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width; ?> box-shadow="0px" height="<?php echo get_custom_header()->height; ?> alt="" /></a>
    		<?php endif; ?>
    <?php endif; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Mobile Conditional Tags… Am I Doing This Right?’ is closed to new replies.