-
AuthorPosts
-
March 18, 2015 at 1:06 pm #413570
Hey Kiesi,
How do I change files that are included in the function file in a child theme?
I cant just copy the folder and change the php file.I tried added this to my function in the child :
require_once( get_template_directory_uri() . ‘/includes/loop-page.php’ );
Then i get this error :
Fatal error: Call to undefined function avia_get_option() in /var/www/sinsio.dk/bolig/wp-content/themes/sinsio-child/loop-index.php on line 6March 18, 2015 at 1:32 pm #413596Hey designspecialisten!
Thank you for using our theme.
Functions.php of the child theme is loaded BEFORE functions.php of the parent theme, which loads the avia framework and other stuff needed for the template files.
Add the following to your functions.php of the child theme:
function my_setups_needed() { // add all your setups or include files from the child theme } add_action( 'after_setup_theme', 'my_setups_needed', 100 );
This hook is called right after functions.php of the parent theme had been loaded.
http://codex.wordpress.org/Plugin_API/Action_Reference/after_setup_themeBest regards,
GünterMarch 18, 2015 at 1:39 pm #413600Then i get another bug from the parent theme :
http://bolig.sinsio.dk/stue/Intet fundet
Beklager, ingen indlæg matchede dine kriterier.Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /var/www/sinsio.dk/bolig/wp-content/themes/sinsio-child/includes/loop-index.php:267) in /var/www/sinsio.dk/bolig/wp-content/themes/sinsio/config-templatebuilder/avia-shortcodes/masonry_entries.php on line 32
March 18, 2015 at 1:59 pm #413611Hey!
Thank you for coming back.
If you want to change a tempate file, you have to copy the original file to the child (same directory structure) and modify this file
(http://codex.wordpress.org/Child_Themes).In your case: enfold-child/includes/loop-page.php
Best regards,
GünterMarch 18, 2015 at 2:01 pm #413616I did like this :
In functions :
function sinsio_setup_child_theme() {
/* add all your setups or include files from the child theme */
require_once( get_stylesheet_directory() . ‘/functions-enfold.php’ );
require_once( get_stylesheet_directory() . ‘/includes/loop-index.php’ );
}And i have the folder + the file copied into the child theme.
Still I get the header sent error.
March 18, 2015 at 5:40 pm #413808Hey!
Try the following:
Put your modified loop-index.php in enfold-child/includes/loop-index.php
The original functions-enfold.php does not need to be copied – it is loaded by the parent theme from the parent theme folder.
If you do not need any other functions, that’s it.
WP should load your new loop-index.php now.
Best regards,
GünterMarch 18, 2015 at 10:57 pm #414029I know, but i need the hole php file content, but then i get that error I posted you 3 times now. Can you please help me why its getting that bug?
I need to change the html output in the file, and other files in the parent theme into the child theme.
regards
IvanMarch 19, 2015 at 3:06 pm #414458Hey!
Why do you need the functions-enfold.php file in the child theme? If you want to add new functions, you can add it directly to the child theme’s functions.php file. If you duplicate the functions-enfold.php file then you have to update it every time a new version of the theme or patch is available. Try to add this to the php.ini file, it should fix the session start issue:
session.save_path = /tmp
Regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.