Can I create a Home Widget that sits underneath the logo on home page only?

Community Forums Forums Design Tips and Tricks Can I create a Home Widget that sits underneath the logo on home page only?

This topic is: resolved

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  zmel 1 year, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34448

    zmel
    Participant
    Post count: 31

    I have a customized, widgeted front page at this dev site: http://dev3.dizzysushi.com/

    I’d like to have the fish image, (currently the first text box with html in home bottom #3, executive theme), continue to be a widget, but be located up, and behind the current logo. It can only show on the home page, so the right-header widget area won’t work, (and it sits in front of logo).

    I tried making a negative top margin, in the CSS without luck. Any suggestions? Thanks!

    #34536

    UT Mod
    Participant
    Post count: 160

    Give this to your fish widget (in css)

        position: absolute;
        top: 12px;
        z-index: 9999;

    and this in

    #title-area {

        position: absolute;
        z-index: 99999;

    }

    That may solve one part of your problem.

    #34548

    zmel
    Participant
    Post count: 31

    Thank you, Vajrasar! That worked great. I added some margin-left and it put it just where I want.

    You made my day :0)

    #34575

    UT Mod
    Participant
    Post count: 160

    Am really glad it worked. Now, for the first part of your problem as you said you have made a custom widgetized template and want to show that fish widget only on front page then you can wrap the code producing that fish widget inside is_front_page() if-else loop.

    like -

    if (is_front_page()) {
    //do widget code
    }

    I think this may help you.

    Else if you are using Appereance -> widget to place code using a text widget then you can

    1) enable php in widgets by putting this code in functions.php

    add_filter('widget_text','execute_php',100);
    function execute_php($html){
    if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html);
    $html=ob_get_contents();
    ob_end_clean();
    }
    return $html;
    }

    and then place the code you pasted/wrote in the text widget inside if-else loop as -

    if (is_front_page()) {
    //put fish code/image
    }

    I hope it helps.

    #34651

    zmel
    Participant
    Post count: 31

    With the theme I am using, it looks like I can keep the html for the fish widget in the appearances/widget home box without having to change the functions.php; it only shows on home page. But I will keep your info for any future use. Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.