• Resolved Lyubomir

    (@lyubomir)


    Guys, how can I add a divider between the slider and the featured pages area on the front page?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Site link would help

    Various way to do that, for example, since fp generally are only only in home, you can add this to your child theme functions.php :

    add_action('__before_fp', 'add_divider_bar');
    function add_divider_bar(){
        echo '<hr class="featurette-divider '. current_filter() .'">';
    }

    and style it with:
    .featurette-divider.__before_fp
    (in this case the featurette divider will be a child of .container-marketing, the featured pages container)

    or if you want to place it a between the two blocks you can use this

    add_filter('tc_slider_display', 'add_divider_bar');
    function add_divider_bar($html){
        if ( ! tc__f('__is_home') )
            return $html;
        return $html.'<hr class="featurette-divider '. current_filter() .'">';
    }

    and style it with .featurette-divider.tc_slider_display, or also, considering that the slider is hooked (if you didn’t change it) to __after header with priority 10:

    add_action('__after_header', 'add_divider_bar', 15);
    function add_divider_bar(){
        if ( ! tc__f('__is_home') )
            return;
        echo '<hr class="featurette-divider '. current_filter() .'">';
    }

    and in this case: .featurette-divider.__after_header. But to make this more general you should also do some check on the slider existence. Of course in your case you already know you use it, so you don’t need these checks ??
    But to be honest, among this last solution and the second, I will choose the second, ’cause it’ll be sure the divider will be displayed after the slider, and just when it exists

    Thread Starter Lyubomir

    (@lyubomir)

    @d4z_c0nf: Because I need to modify the functions.php file I downloaded first the Customizr Child theme, activated it and modified the functions.php file of the Child theme with the following code copied from above:

    add_filter('tc_slider_display', 'add_divider_bar');
    function add_divider_bar($html){
        if ( ! tc__f('__is_home') )
            return $html;
        return $html.'<hr class="featurette-divider '. current_filter() .'">';
    }

    Then I saved the file and suddenly I had a blank page! I don’t know what happened but now the website cannot be loaded. I cannot access anything, I cannot reverse. What to do now?

    You already know my website, but still, let me mention it: https://heartandsun.org

    Thread Starter Lyubomir

    (@lyubomir)

    I deleted the functions.php file of the child theme via FTP and now the site is running OK. So, I continue with the divider ??

    Thread Starter Lyubomir

    (@lyubomir)

    @d4z_c0nf: you rock! Your suggestion works perfectly. I chose the first option

    add_action('__before_fp', 'add_divider_bar');
    function add_divider_bar(){
        echo '<hr class="featurette-divider '. current_filter() .'">';
    }

    because the divider width is limited to the width of the featured pages area. In the other two cases the divider is as wide as the the screen itself which does not correspond with the other divider under the featured pages area.
    The topic is resolved! Thanks a lot! You helped me twice today!

    functions.php should have

    <?php

    on first line and the actual code should begin from second line. This is true for any “pure” php file. Also, in most cases, it’s very important that before the starting “<” there is no character, no empty space, tab, or empty line. That might have caused the WSOD.

    Try again but this time change line 5 from that code with

    return $html.'<hr class="featurette-divider">';

    I might be wrong, but current_filter() might not be callable in your functions.php and that might also cause a WSOD.

    @lyubomir
    Sorry I went to sleep ..
    Glad you solved ??

    Thread Starter Lyubomir

    (@lyubomir)

    @d4z_c0nf
    Yes, I managed by following the steps from another thread. I accessed the functions.php file of the Child theme via FTP, deleted it and then re-uploaded a cleaned file. By the way, the issue was not in your coding. I didn’t comment properly. Thanks and cheers! ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add a divider between the slider and featured pages area’ is closed to new replies.