• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Conditional Tags – Mobile

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Conditional Tags – Mobile

This topic is: resolved

Tagged: conditional tags, mobile

  • This topic has 3 replies, 2 voices, and was last updated 9 years, 11 months ago by jackirt.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • April 4, 2016 at 3:49 pm #182918
    jackirt
    Member

    I've added this bit of code to my functions.php file to move my site title and description to the top of my sidebar, which works perfectly.

    //* Reposition Title Area
    remove_action( 'genesis_header', 'genesis_do_header' );
    add_action( 'genesis_before_sidebar_widget_area', 'genesis_site_title' );
    add_action( 'genesis_before_sidebar_widget_area', 'genesis_site_description' );

    However, I'd like to add to the code my creating a conditional tag: where if the user is on a mobile device (tablet, phone, etc) that the site title be displayed as normal in the header. I've tried creating my own conditional statements, but to no avail.

    Any input is appreciated!

    April 4, 2016 at 4:16 pm #182922
    Victor Font
    Moderator

    You can use the wp_is_mobile conditional. It checks if the user is visiting using a mobile device.

    if ( wp_is_mobile() ) {
    	/* Display and echo mobile specific stuff here */
    }

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    April 4, 2016 at 4:20 pm #182923
    jackirt
    Member

    Hi Victor,

    I've tried writing a code that contains that bit of code, but with my little knowledge, the code I've written ends up breaking my site or not doing anything.

    What should I adjust out of this code?

    //* Reposition Title Area
    remove_action( 'genesis_header', 'genesis_do_header' );
    add_action( 'genesis_before_sidebar_widget_area', 'genesis_site_title' );
    add_action( 'genesis_before_sidebar_widget_area', 'genesis_site_description' );
    if ( wp_is_mobile() ) {
    	remove_action( 'genesis_before_sidebar_widget_area', 'genesis_site_title' );
        remove_action( 'genesis_before_sidebar_widget_area', 'genesis_site_description' );
        add_action( 'genesis_header', 'genesis_do_header' );
    }
    April 4, 2016 at 7:49 pm #182943
    jackirt
    Member

    Actually I've got it to work.

    Thanks!

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble