Tagged: child theme, functions.php
-
AuthorPosts
-
February 10, 2015 at 8:56 am #393556
Hi there,
We are still nervous about making a child theme for one of our existing sites. At the top and the bottom of the existing functions.php file we have the following (please see below). What should we do with this code after moving to a child theme?
Many thanks,
RobertAT THE TOP:
<?php
global $avia_config;
add_theme_support(‘avia_template_builder_custom_css’);
add_filter( ‘avf_google_heading_font’, ‘avia_add_heading_font’);
function avia_add_heading_font($fonts)
{
$fonts[‘Archivo Narrow’] = ‘Archivo Narrow:700’;
return $fonts;
}add_filter( ‘avf_google_content_font’, ‘avia_add_content_font’);
function avia_add_content_font($fonts)
{
$fonts[‘Archivo Narrow’] = ‘Archivo Narrow:700’;
return $fonts;
}add_filter( ‘woocommerce_product_review_list_args’, ‘wc_reverse_product_reviews’ );
function wc_reverse_product_reviews( $args ) {
$args[‘reverse_top_level’] = true;return $args;
}/*
* if you run a child theme and dont want to load the default functions.php file
* set the global var below in you childthemes function.php to true:
*
* example: ………AT THE BOTTOM:
/*
* register custom functions that are not related to the framework but necessary for the theme to run
*/require_once( ‘functions-enfold.php’);
add_action( ‘woocommerce_email_before_order_table’, ‘add_link_back_to_order’, 10, 2 );
function add_link_back_to_order( $order ) {
// Open the section with a paragraph so it is separated from the other content
$customMessage = ‘<p>’;
$customMessage .= ‘PLEASE NOTE: The audio files for the Listening and Speaking tests are ‘;
$customMessage .= ‘inside the PDF files. For best results, please make sure you have the ‘;
$customMessage .= ‘latest version of Adobe Reader installed on your device. When you open ‘;
$customMessage .= ‘these tests with Adobe Reader simply click on the icon in the top right’;
$customMessage .= ‘had corner and the audio player will appear on your screen. You can ‘;
$customMessage .= ‘download Adobe Reader free at: ‘;
$customMessage .= ‘http://get.adobe.com/reader’;
// Return the message into the email
echo $customMessage;
}February 10, 2015 at 11:40 am #393615Hi rpl_admin!
Thank you for coming back.
Functions.php of the child theme is loaded BEFORE functions,php of the parent theme Enfold.
That means, you can move all
add_action(.......) add_filter (....)
AND all functions corresponding to these hooks to the child theme functions.php (and delete them from the parent functions.php).
DO NOT REMOVE OR COPY from the parent theme:
/* * register custom functions that are not related to the framework but necessary for the theme to run */ require_once( ‘functions-enfold.php’);
I think you will need the functionality of Enfold, so do not supress the loading of function.php of the parent theme.
Hope, this will help you.
Come back if you are not sure.
Cheers!
GünterFebruary 19, 2015 at 11:20 am #398774Hi Gunter,
Many thanks for your help on this – finally our child is born!
Robert
-
AuthorPosts
- The topic ‘Child Theme & Functions.php’ is closed to new replies.