• I tried to add 4th slide on Simplify theme but the 4th is always showing same as 3rd slide, does anyone have same issue? can anyone help to fix it?

    The code change I did is:
    front-page.php:

    <div id="slide-container">
    <div id="slide">
    <img src="<?php echo esc_url(of_get_option('banner-image', get_template_directory_uri() . '/images/slide-image/slide-image1.jpg')); ?>"/>
    
    <?php if ( esc_url(of_get_option('slide-image', get_template_directory_uri() . '/images/slide-image/slide-image2.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('slide-image', get_template_directory_uri() . '/images/slide-image/slide-image2.jpg')); ?>"/>
    <?php endif; ?>
    
    <?php if ( esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image3.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image3.jpg')); ?>"/>
    <?php endif; ?>
    
    <?php if ( esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg')); ?>"/>
    <?php endif; ?>
    
    </div>
    </div> <!-- slide-container -->

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter mdivk

    (@mdivk)

    Thank you very much

    Thread Starter mdivk

    (@mdivk)

    Can anyone help? Thanks lots.

    Hi, you just solve my issue and no one solves yours, so look, you have to change the code in 3 places:

    [Moderator note: Best practice is to use a child theme for any modifications to a theme – otherwise the files you modified will be overwritten and lost when the theme is updated:
    https://codex.www.ads-software.com/Child_Themes ]

    front-page.php
    options.php
    functions.php

    So , let’s start. You say you want to have a 4th slide, and your problem is that you’re calling the same image, look you have ‘extra-image’ so that is the ID, if you change it for ‘extra-image1’ it’ll work for an extra slide

    frontpage.php

    <?php if ( esc_url(of_get_option('extra-image1', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('extra-image1', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg')); ?>"/>
    <?php endif; ?>

    so, the entire code will be like:

    <div id="slide-container">
    <div id="slide">
    <img src="<?php echo esc_url(of_get_option('banner-image', get_template_directory_uri() . '/images/slide-image/slide-image1.jpg')); ?>"/>
    
    <?php if ( esc_url(of_get_option('slide-image', get_template_directory_uri() . '/images/slide-image/slide-image2.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('slide-image', get_template_directory_uri() . '/images/slide-image/slide-image2.jpg')); ?>"/>
    <?php endif; ?>
    
    <?php if ( esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image3.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image3.jpg')); ?>"/>
    <?php endif; ?>
    
    <?php if ( esc_url(of_get_option('extra-image1', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg')) != '' ) : ?>
    
    <img src="<?php echo esc_url(of_get_option('extra-image1', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg')); ?>"/>
    <?php endif; ?>
    
    </div>
    </div> <!-- slide-container -->

    options.php try to find this code and replace it:

    $options[] = array(
    		'name' => __('Banner Image/ Slide Image 01',  'simplify'),
    		'desc' => __('Upload an image for the Front Page Banner. 930px X 350px image is recommended.',  'simplify'),
    		'id' => 'banner-image',
    		'std' => get_template_directory_uri() . '/images/slide-image/slide-image1.jpg',
    		'type' => 'upload');
    
    	$options[] = array(
    		'name' => __('Slide Image 02',  'simplify'),
    		'desc' => __('Upload an image for the Front Page Banner. 930px X 350px image is recommended. Leave this field blank if you do not want any slider.', 'simplify'),
    		'id' => 'slide-image',
    		'std' => get_template_directory_uri() . '/images/slide-image/slide-image2.jpg',
    		'type' => 'upload');
    
    	$options[] = array(
    		'name' => __('Slide Image 03',  'simplify'),
    		'desc' => __('Upload an image for the Front Page Banner. 930px X 350px image is recommended. Leave this field blank if you do not want any slider.', 'simplify'),
    		'id' => 'extra-image',
    		'std' => get_template_directory_uri() . '/images/slide-image/slide-image3.jpg',
    		'type' => 'upload');	
    
    	$options[] = array(
    		'name' => __('Slide Image 04',  'simplify'),
    		'desc' => __('Upload an image for the Front Page Banner. 930px X 350px image is recommended. Leave this field blank if you do not want any slider.', 'simplify'),
    		'id' => 'extra-image1',
    		'std' => get_template_directory_uri() . '/images/slide-image/slide-image4.jpg',
    		'type' => 'upload');

    So, now you can upload from the simplify options, and the last step:

    functions.php try to find this code and replace it:

    if ( esc_url(of_get_option('slide-image', get_template_directory_uri() . '/images/slide-image/slide-image2.jpg')) != '' || esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image3.jpg')) != '' || esc_url(of_get_option('extra-imagen', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg'))  != '') :
    	wp_enqueue_script( 'simplify-slider', get_template_directory_uri(). '/js/jqFancyTransitions.1.8.min.js', array( 'jquery' ) );
    	endif;

    that’s it…
    have a nice day.
    And thank you.

    Sorry, the last code was wrong, this is the correct one.

    functions.php:

    if ( esc_url(of_get_option('slide-image', get_template_directory_uri() . '/images/slide-image/slide-image2.jpg')) != '' || esc_url(of_get_option('extra-image', get_template_directory_uri() . '/images/slide-image/slide-image3.jpg')) != '' || esc_url(of_get_option('extra-image1', get_template_directory_uri() . '/images/slide-image/slide-image4.jpg'))  != '') :
    	wp_enqueue_script( 'simplify-slider', get_template_directory_uri(). '/js/jqFancyTransitions.1.8.min.js', array( 'jquery' ) );
    	endif;

    If you modify theme files your changes will be lost when the theme is updated – not a good idea. Use a child theme to avoid that bad situation:

    https://codex.www.ads-software.com/Child_Themes

    Thread Starter mdivk

    (@mdivk)

    Thank you very much sofdata and yogi

    I did a quick experiment:

    I created a child theme, suggested changes were made in child theme files, nothing else, I didn’t touch css

    Once I activate the newly created child theme, some fonts are changed.

    Why? what is causing the change and how do I control the change?

    Thank you again for your help, I am new to theme customization, your patience is greatly appreciated and please pardon any naive questions.

    Thread Starter mdivk

    (@mdivk)

    I don’t know what happened, but the issue disappeared once I refreshed my browser: I never changed css, how come a different font could ever show up?

    By the way: is font file saved somewhere in the theme folder? how can I use my own font?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Display extra slide on Simplify theme’ is closed to new replies.