I am trying to have the call to action on every page and am looking for the code to add to the child theme Functions page. I tried the Sparkling example and changed wording but likely not that simple…i tried this
if ( ! function_exists( ‘dazzling_call_for_action’ ) ) :
/**
Call for action text and button displayed above content
*/
function dazzling_call_for_action() {
if ( of_get_option( ‘w2f_cfa_text’ )!=’’){
echo ‘<div class=“cfa”>’;
echo ‘<div class=“container”>’;
echo ‘<div class=“col-sm-8”>’;
echo ‘<span class=“cfa-text”>’. of_get_option( ‘w2f_cfa_text’ ).’</span>’;
echo ‘</div>’;
echo ‘<div class=“col-sm-4”>’;
echo ‘’. of_get_option( ‘w2f_cfa_button’ ). ‘ ’;
echo ‘</div>’;
echo ‘</div>’;
echo ‘</div>’;
}
}
endif;
BTW great theme and excellent documentation…cheers from Kelowna,British Columbia
movin
July 7, 2015, 1:15pm
2
Hi @mikewh ,
I hope you are well today and thank you for your question.
To achieve this you have to add the following code in the functions.php file of your child theme
/**
* Call for action button & text area
*/
function dazzling_call_for_action() {
if ( of_get_option('w2f_cfa_text')!=''){
echo '<div class="cfa">';
echo '<div class="container">';
echo '<div class="col-md-8">';
echo '<span class="cfa-text">'. of_get_option('w2f_cfa_text').'</span>';
echo '</div>';
echo '<div class="col-md-4">';
echo '<a class="btn btn-lg cfa-button" href="'. of_get_option('w2f_cfa_link'). '">'. of_get_option('w2f_cfa_button'). '</a>';
echo '</div>';
echo '</div>';
echo '</div>';
} else; {
//Do nothing
}
}
And you have to add the following code at bottom end of the file header.php in your child theme.
<?php if ( ! is_front_page() ) {
dazzling_call_for_action();
} ?>
I have attached the sample child theme containing these changes which you can refer to implement these changes in your child theme.
Best Regards,
Movin