WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting functions.php error on child theme (3 posts)

  1. jepser
    Member
    Posted 3 years ago #

    Hi!
    I'm using child themes with a parent I create. I have the function:

    function get_block($block_url){
    	$bloque = include(TEMPLATEPATH . '/includes/' . $block_url . '.php');
    	return $bloque;
    }

    This function is for include blocks of code like

    <?php get_block('custom-sub') ?> so here I have it in the /wp-content/themes/parent-theme/includes/thefile.php

    But now I want to include custom blocks that are only for child themes, that are located in /wp-content/themes/child-theme/includes/thefile.php

    But I'm getting this error:

    Warning: include(C:\server\ugalileo/wp-content/themes/galileo-main/includes/carreras-list.php) [function.include]: failed to open stream: No such file or directory in C:\server\ugalileo\wp-content\themes\galileo-facultades\functions.php on line 5

    Warning: include() [function.include]: Failed opening 'C:\server\ugalileo/wp-content/themes/galileo-main/includes/carreras-list.php' for inclusion (include_path='.;C:\php5\pear') in C:\server\ugalileo\wp-content\themes\galileo-facultades\functions.php on line 5

    I tried to make a get_child_block in the childs functions.php but I didn't helps me.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try:

    function get_block($block_url){
    	$bloque = include(get_stylesheet_directory() . '/includes/' . $block_url . '.php');
    	return $bloque;
    }
  3. jepser
    Member
    Posted 3 years ago #

    thanks dude!

Topic Closed

This topic has been closed to new replies.

About this Topic