WordPress.org

Forums

Customizr
[resolved] add-content-above-featured-pages (4 posts)

  1. Leapmkt12
    Member
    Posted 10 months ago #

    Hi I have been trying to add content to the front page with no luck. http://www.mermaidpavingandtiling.com.au
    My tc_header, footer, fpu, etc are all 1170px wide. I have a picture background so I have adjusted all the bottom margins so there is no gaps. I had used the content below slider snippet & had the content as a 'blockquote' which was fine until I changed everything to 1170px wide. I can adjust the right margin so it looks ok in Chrome but out of line in IE & on mobile. I need to have a white background for this content & for it to be inline with the header & FPU's.
    The php code I am using is:
    'add_filter('tc_fp_block_display', 'content_before_fp');
    function content_before_fp($html) {
    $before_fp = '<div class=home-content><p>
    Mermaid Paving & Tiling are a professional team who offer a wide range of services within the scope of tiling, paving and artistic rock work, water features, sandstone, ceramics, glass mosaic, granite and more. With more than 20 years experience, we look after some of the biggest pool companies here on the Gold Coast, alongside resorts and even domestic home paving and tiling. We specialise in pool copings, pool tiling and pool surrounds and are the experts from sandstone to porcelain and everything in between.
    We offer the following services:

    • All pool tiling and surrounds
    • Pool renovations both residential and commercial
    • Residential tiling and paving
    • Commercial tiling and paving
    • Artistic Rock work, from sandstone to granite
    We guarantee our work to the highest standard and take the time with you to ensure we understand what you need and want from your tiling or paving project. In turn, you receive the best professional advice not only on the materials but the best procedure for your job. We strive to give you the finish you deserve so feel free to call for a quote on your project.</p>'; //Put your HTML inside this var
    return $before_fp.$html;'

    I've tried creating a div class & using css:
    '#home-content {
    background-color: #FAFAFA;
    font-size: 17.5px;
    font-weight: 300;
    line-height: 1.25;
    width: 1170px;
    text-align: left;
    padding-right: 8px;
    }'
    Any help where I am going terribly wrong would be appreciated.

  2. ElectricFeet
    Member
    Posted 10 months ago #

    OK, there are several issues all intertwined here and apart from the text not displaying, I'm not sure I understand what they all are. Let's try to tease them out:

    1. Your background image. The best way to make sure your image covers the whole area without a nasty repeat is to use the cover value in background-size property. See example here.

    2. Your text between the slider and the featured pages. I think the problem here is that you are using Customizr featured pages hooks, but you have fpu installed. However .... You are currently using a snippet that places text before the featured pages. But this is not just a line or two; it's a significant amount of text. If the text changes, then you're going to be editing content inside a php file, which is not ideal.

    A better approach would be to create a page (call it "home") and define this as your static page in the Customizr front page settings. Then put all the text in there. Doing this will put all that text on your front page.

    You will now have a page of text on your front page that's easy to update.

    But the text is after the featured pages, so the next step is to use the snippet to move the featured pages after this content. You will need to hook the featured pages on to the __after_main_container hook. So the code will be:

    // Move Customizr featured pages
    add_action ( 'wp_head' , 'move_my_fp');
    function move_my_fp() {
        //we unhook the featured pages
        remove_action  ( '__before_main_container', array( TC_featured_pages::$instance , 'tc_fp_block_display'), 10 );
    
        //we re-hook the block. Check out the priority here : set to 0 to be the first in the list of different actions hooked to this hook
        add_action  ( '__after_main_container', array( TC_featured_pages::$instance , 'tc_fp_block_display'), 0 );
    }

    If you're using featured pages unlimited, then I think the code will be:

    // Move Customizr featured pages
    add_action ( 'wp_head' , 'move_my_fp');
    function move_my_fp() {
        //we unhook the featured pages
        remove_action  ( '__before_main_container', array( TC_front_fpu::$instance , 'tc_fp_block_display'), 10 );
    
        //we re-hook the block. Check out the priority here : set to 0 to be the first in the list of different actions hooked to this hook
        add_action  ( '__after_main_container', array( TC_front_fpu::$instance , 'tc_fp_block_display'), 0 );
    }

    3. Any other problems? Not clear from your text. You seem to be having an issue with widths, but I'm not sure what it is, as the page looks good.

  3. Leapmkt12
    Member
    Posted 10 months ago #

    Once again Electric Feet you are a legend!! Thank you so much It is all working fantastic & I have a happy customer. Thanks

  4. ElectricFeet
    Member
    Posted 10 months ago #

    Great :-)

Reply

You must log in to post.

About this Theme

About this Topic