• Resolved pkswindale

    (@pkswindale)


    PLEASE HELP! I have just tried to amend code in the function.php file which has given me the error

    Fatal error: Call to undefined function get_template_directory() in /home/reusable/re-wrap-it/wp-includes/functions.php on line 5

    I restored the to original file and the error is still coming up.

    I need to get a clients website back up ASAP so any help would be most appreciated.

    The file consists of the following:

    <?php
    // ==================================================================
    // Included libraries
    // ==================================================================
    require_once( get_template_directory() . ‘/includes/ace_functions.php’ );
    require_once( get_template_directory() . ‘/includes/ace_import_export.php’ );
    require_once( get_template_directory() . ‘/includes/ace_options.php’ );
    require_once( get_template_directory() . ‘/includes/ace_theme_customize.php’ );
    require_once( get_template_directory() . ‘/includes/ace_updates.php’ );
    require_once( get_template_directory() . ‘/includes/custom_post.php’ );
    require_once( get_template_directory() . ‘/includes/custom_widgets.php’ );
    require_once( get_template_directory() . ‘/includes/meta_boxes.php’ );
    require_once( get_template_directory() . ‘/includes/modules.php’ );
    require_once( get_template_directory() . ‘/includes/quicktags.php’ );
    require_once( get_template_directory() . ‘/includes/shortcodes.php’ );
    require_once( get_template_directory() . ‘/includes/widgets.php’ );

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael

    (@alchymyth)

    you seem to have edited the wrong file by mistake – don’t edit any files within the /wp-includes/ directory.
    to restore /wp-includes/functions.php to its origina state of wp4.5.2, get the code possibly from https://github.com/WordPress/WordPress/blob/master/wp-includes/functions.php

    were you aiming for functions.php of your theme, or any other functions.php file in your theme’s folders?
    what are you trying to achieve?

    Thread Starter pkswindale

    (@pkswindale)

    Hi Michael,

    Thanks for coming back to me. Yes, I was aiming for the theme functions.php. I was looking to insert the following code to remove product category count.

    /*
    * Removes products count after categories name
    */
    add_filter( ‘woocommerce_subcategory_count_html’, ‘woo_remove_category_products_count’ );

    function woo_remove_category_products_count() {
    return;
    }

    Where in the specified file would I find the right code? I’m using version 4.4.2. Thanks for your help.

    Thread Starter pkswindale

    (@pkswindale)

    Hi Michael,

    I have managed to restore using a previous ‘original’ file.

    Thanks for your help.

    Michael

    (@alchymyth)

    [ignore this – I was typing while you resolved the problem]

    this is a wp4.4 link with the code of the broken file https://github.com/WordPress/WordPress/blob/4.4-branch/wp-includes/functions.php

    first step, if you haven’t done yet, is to restore the broken functions.php in the /wp-includes/ folder.

    what theme exactly are you editing?

    are you using a child theme?

    functions.php of your theme should be in
    /wp-content/themes/yourthemename/functions.php

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘FATAL ERROR: Call to undefined function get_template_directory() in’ is closed to new replies.