Add Overlay To Homepage Header

I am using Sydney theme here https://www.getresonate.com

I want to add the code on this page https://www.getresonate.com/button on top of the homepage header image (below the sub-head Resonate - Tune In to People). Is there a way to do this? I have searched and searched online to no avail. Thanks

Hello there,

To add a couple of extra code in the main slider, you’d need to replicate the sydney_slider_template() function from sydney/inc/slider.php file in to your child theme’s function. To put the code after the sub title, find this code:


<?php echo $button; ?>

then alter it with your code.

Regards,
Kharis

Thanks Kharis,

I am not sure how to replicate the syndey_slider_template() function from sydney/inc/slider.php file in to my child theme function. Can you please give me step by step instructions on how to do that?

If I go to Appearance > Editor, under them to edit for child-sydney, all I currently see on the left is child-sydney: Stylesheet (style.css) with this code:

/*
Theme Name: child-sydney
Version: 1.0
Description: A child theme of Sydney
Template: sydney
*/

@import url("…/sydney/style.css");

On the right, under Styles, it shows:

Stylesheet
(style.css)

Thanks

Hello there,

Copy this function into your child theme’s functions.php file.


function sydney_slider_template() {

    if ( (get_theme_mod('front_header_type','slider') == 'slider' && is_front_page()) || (get_theme_mod('site_header_type') == 'slider' && !is_front_page()) ) {

    //Get the slider options
    $speed      = get_theme_mod('slider_speed', '4000');
    $text_slide = get_theme_mod('textslider_slide', 0);
    $button     = sydney_slider_button();
    $mobile_slider = get_theme_mod('mobile_slider', 'responsive');

    //Slider text
    if ( !function_exists('pll_register_string') ) {
    	$titles = array(
    		'slider_title_1' => get_theme_mod('slider_title_1', 'Welcome to Sydney'),
    		'slider_title_2' => get_theme_mod('slider_title_2', 'Ready to begin your journey?'),
    		'slider_title_3' => get_theme_mod('slider_title_3'),
    		'slider_title_4' => get_theme_mod('slider_title_4'),
    		'slider_title_5' => get_theme_mod('slider_title_5'),
    	);
    	$subtitles = array(
    		'slider_subtitle_1' => get_theme_mod('slider_subtitle_1', 'Feel free to look around'),
    		'slider_subtitle_2' => get_theme_mod('slider_subtitle_2', 'Feel free to look around'),
    		'slider_subtitle_3' => get_theme_mod('slider_subtitle_3'),
    		'slider_subtitle_4' => get_theme_mod('slider_subtitle_4'),
    		'slider_subtitle_5' => get_theme_mod('slider_subtitle_5'),    		
    	);
    } else {
    	$titles = array(
    		'slider_title_1' => pll__( get_theme_mod('slider_title_1', 'Welcome to Sydney') ),
    		'slider_title_2' => pll__( get_theme_mod('slider_title_2', 'Ready to begin your journey?') ),
    		'slider_title_3' => pll__( get_theme_mod('slider_title_3') ),
    		'slider_title_4' => pll__( get_theme_mod('slider_title_4') ),
    		'slider_title_5' => pll__( get_theme_mod('slider_title_5') ),
    	);
    	$subtitles = array(
    		'slider_subtitle_1' => pll__( get_theme_mod('slider_subtitle_1', 'Feel free to look around') ),
    		'slider_subtitle_2' => pll__( get_theme_mod('slider_subtitle_2', 'Feel free to look around') ),
    		'slider_subtitle_3' => pll__( get_theme_mod('slider_subtitle_3') ),
    		'slider_subtitle_4' => pll__( get_theme_mod('slider_subtitle_4') ),
    		'slider_subtitle_5' => pll__( get_theme_mod('slider_subtitle_5') ),    		
    	);
    }
    $images = array(
    		'slider_image_1' => get_theme_mod('slider_image_1', get_template_directory_uri() . '/images/1.jpg'),
    		'slider_image_2' => get_theme_mod('slider_image_2', get_template_directory_uri() . '/images/2.jpg'),
    		'slider_image_3' => get_theme_mod('slider_image_3'),
    		'slider_image_4' => get_theme_mod('slider_image_4'),
    		'slider_image_5' => get_theme_mod('slider_image_5'),
    );

    ?>

    <div id="slideshow" class="header-slider" data-speed="<?php echo esc_attr($speed); ?>" data-mobileslider="<?php echo esc_attr($mobile_slider); ?>">
        <div class="slides-container">

        <?php $c = 1; ?>
        <?php foreach ( $images as $image ) {
        	if ( $image ) {
        		?>
                <div class="slide-item" style="background-image:url('<?php echo esc_url( $image ); ?>');">
                    <img class="mobile-slide preserve" src="<?php echo esc_url( $image ); ?>"/>
                    <div class="slide-inner">
                        <div class="contain animated fadeInRightBig text-slider">
                        <h2 class="maintitle"><?php echo esc_html( $titles['slider_title_' . $c] ); ?></h2>
                        <p class="subtitle"><?php echo esc_html( $subtitles['slider_subtitle_' . $c] ); ?></p>
                        </div>
                        <?php echo $button; ?>
                    </div>
                </div>
                <?php
        	}
        	$c++;
        }
        ?>

        </div>  
        <?php if ( $text_slide ) : ?>
            <?php echo sydney_stop_text(); ?>
        <?php endif; ?>
    </div>

    <?php
    }
}


Regards,
Kharis

I am so angry, I tried to do what you suggested, even though it was poorly explained. I placed the edited functions.php in child theme folder using FTP /public_html/wp-content/themes/child-sydney/

But after doing this when I go to https://www.getresonate.com/, now I get this error message:

Warning: require_once(/home/getreson/public_html/wp-content/themes/child-sydney/plugins/class-tgm-plugin-activation.php): failed to open stream: No such file or directory in /home/getreson/public_html/wp-content/themes/child-sydney/functions.php on line 307

Fatal error: require_once(): Failed opening required ‘/home/getreson/public_html/wp-content/themes/child-sydney/plugins/class-tgm-plugin-activation.php’ (include_path=’.:/usr/local/php56/pear’) in /home/getreson/public_html/wp-content/themes/child-sydney/functions.php on line 307

So I went back into /public_html/wp-content/themes/child-sydney/ and deleted the edited functions.php file that I had placed there, to remove the change I had made, but the error message above at https://www.getresonate.com/ is still there.

PLEASE HELP!

Hello there,

Please paste the whole code of your child theme’s functions.php file on tho this service. And then share its link here, so I can replicate it in my child theme to debug the issue.

Regards,
Kharis