WordPress.org

Forums

Customizr
[resolved] Add a divider between the slider and featured pages area (9 posts)

  1. Lyubomir
    Member
    Posted 10 months ago #

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

  2. rdellconsulting
    Member
    Posted 10 months ago #

    Site link would help

  3. d4z_c0nf
    Member
    Posted 10 months ago #

    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

  4. Lyubomir
    Member
    Posted 10 months ago #

    @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: http://heartandsun.org

  5. Lyubomir
    Member
    Posted 10 months ago #

    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 :)

  6. Lyubomir
    Member
    Posted 10 months ago #

    @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!

  7. acub
    Member
    Posted 10 months ago #

    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.

  8. d4z_c0nf
    Member
    Posted 10 months ago #

    @Lyubomir
    Sorry I went to sleep ..
    Glad you solved ;)

  9. Lyubomir
    Member
    Posted 10 months ago #

    @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! :)

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.