• 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

Fatal error: Call to undefined function

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 › General Discussion › Fatal error: Call to undefined function

This topic is: resolved

Tagged: functions, mobile, undefined function

  • This topic has 2 replies, 2 voices, and was last updated 8 years, 7 months ago by neilmac.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • October 2, 2014 at 11:08 am #126564
    neilmac
    Member

    Hello
    Can anyone tell me why this breaks my site?

    if (!is_mobile()) {
    	function test_hook() {
    	?>
    <h3>Random Content Here</h3>
    	<?php
    	}
    	add_action('genesis_before_content_sidebar_wrap','test_hook');
    }

    When I try it in functions.php on my localhost test site using desktop server, it works perfectly. No problem at all.
    Example - http://goo.gl/IEVcPK

    But when I try to use it on a live Genesis site I break the site and get: "Fatal error: Call to undefined function is_mobile()"

    Any ideas?
    Thanks

    October 2, 2014 at 3:10 pm #126582
    SavvyJackie
    Member

    Hi,
    Where is the function is_mobile() defined on the live site?


    Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie

    Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂

    October 2, 2014 at 3:30 pm #126586
    neilmac
    Member

    Hi Jackie
    I think I've just solved it - prodded on by you!
    I think I should have used wp_is_mobile instead of is_mobile.
    Or at least that seems to be working for me now.
    I've been scratching my head about this for ages
    The odd thing is the other way - is_mobile - is still working ok on the local site.
    Anyway, I'll go with what works live. Unless anyone can see a problem with that?
    Thanks very much
    N.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ 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

© 2023 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