• 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

Metro-pro functions.php

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 › Metro-pro functions.php

This topic is: not resolved
  • This topic has 12 replies, 5 voices, and was last updated 2 years, 4 months ago by Anita.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • March 29, 2020 at 4:02 pm #497575
    tpack33
    Member

    Genesis 3.3.1
    Metro-pro theme (fresh download)

    Default functions.php file generates an error:

    Fatal error: Uncaught Error: Call to undefined function get_template_directory() in /home/customer/www/domain/public_html/wp-content/themes/metro-pro/functions.php:14 Stack trace: #0 {main} thrown in /home/customer/www/domain/public_html/wp-content/themes/metro-pro/functions.php on line 14

    ===functions.php===

    // Start the engine.
    include_once( get_template_directory() . '/lib/init.php' );

    ===

    How to fix it?

    March 29, 2020 at 4:18 pm #497576
    Brad Dalton
    Participant

    Do you remove or modify any code in your child theme or Genesis?


    Get Help – Book Consultation.

    March 29, 2020 at 4:34 pm #497580
    tpack33
    Member

    I don't think so, I moved my website to a new hosting server with previous version framework 3.2.1 and my old metro-pro theme (ca 2016). Then downloaded and manually installed the most recent Metro-pro theme and framework 3.3.1. Did some quick customization - everything works as expected.

    I then attempted to add php code to functions.php to read custom.css when I noticed that the default functions.php file is generating the error.

    Just re-uploaded clean functions.php - the same error

    just to be clear - the website running fine, only noticed the error when reviewing php_errorlog file

    March 29, 2020 at 4:43 pm #497581
    Brad Dalton
    Participant

    Might be the PHP version.


    Get Help – Book Consultation.

    March 29, 2020 at 4:47 pm #497582
    tpack33
    Member

    Just to be clear - the website running fine, only noticed the error when reviewing php_errorlog file

    March 29, 2020 at 5:02 pm #497585
    tpack33
    Member

    changed PHP version from 7.316 to 7.013 but didn't help

    March 29, 2020 at 5:45 pm #497586
    Anita
    Keymaster

    Did you by any chance change the name of the theme anywhere?


    Love coffee, chocolate and my Bella!

    March 29, 2020 at 7:44 pm #497590
    tpack33
    Member

    No, I didn't. I downloaded fresh zip package from Studiopress just today and uploaded via FTP to new server simply replacing old Metro theme.

    Maybe I should have installed it from WP admin panel?

    March 29, 2020 at 8:36 pm #497592
    tpack33
    Member

    There was another SG plugin that was generating other unrelated errors due to the upload path of the website being incorrect after website move.

    Is it possible that the genesis/metro-pro also getting the upload path incorrectly?

    However, don't know where to check that setting

    March 30, 2020 at 6:36 am #497597
    Victor Font
    Moderator

    Install the Kint debugger and activate it. Then to see the path, in functions.php add

    d( get_template_directory() );

    It will show you on the screen what's happening.

    The error you're seeing though "Call to undefined function get_template_directory()" indicates that WordPress isn't fully loaded before the child theme, which is really odd. get_template_directory() is a WordPress function. It should be loaded well before the theme.


    Regards,

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

    April 1, 2020 at 2:58 pm #497662
    tpack33
    Member

    Kint plugin indicates that get_template_directory() path is pointing to
    wp-content/themes/genesis as it should?

    October 4, 2020 at 12:32 pm #501323
    wanderer
    Participant

    Did you figure this out? I am having the same problem.

    October 4, 2020 at 1:09 pm #501326
    Anita
    Keymaster

    @wanderer share a link to your site please and what theme are you using?


    Love coffee, chocolate and my Bella!

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 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