WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Why isn't this div showing? (7 posts)

  1. thegreatdanton
    Member
    Posted 3 years ago #

    Hi there,

    I am using wordpress to design a website. I bought a theme and installed it. I am trying to fit a small div next to my header logo, so I'm trying to have the same as the attached screenshot. However, I can't seem to get it to work. I've edited the header.php file and the css file but it's still not showing.

    The header.php code is:

    <div id="top">
                        <?php
                        $logotype = get_option('templatesquare_logo_type');
                        $logoimage = get_option('templatesquare_logo_image');
                        $sitename = get_option('templatesquare_site_name');
                        $tagline = get_option('templatesquare_tagline');
                        if($logoimage == ""){ $logoimage = get_bloginfo('template_url') . "/images/logo.png"; }
                        ?>
                <?php if($logotype == 'textlogo'){ ?>
                <div id="logo">
                        <?php if($sitename=="" && $tagline==""){?>
                                <h1><a href="<?php echo get_option('home'); ?>/" title="<?php _e('Click for Home','templatesquare'); ?>"><?php bloginfo('name'); ?></a></h1>
                            <span class="desc"><?php bloginfo('description'); ?></span>
                        <?php }else{ ?>
                            <h1><a href="<?php echo get_option('home'); ?>/" title="<?php _e('Click for Home','templatesquare'); ?>"><?php echo $sitename; ?></a></h1>
                            <span class="desc"><?php echo $tagline; ?></span>
                        <?php }?>
                </div><!-- end #logo -->
                <div id="media"><p>test</p></div>
                <?php } else { ?>
                        <div id="logo"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo $logoimage;?>" alt="" /></a></div><!-- end #logo -->
                <?php }?>
                </div><!-- end top -->

    and the css code is:

    #top{height:125px;}
    #logo{width: 750px; height: 125px;}
    #media{width: 170px; height: 125px; background: red; margin:0px 0px 0px 760px; float: right;}

    Can anyone please help me to make this media div visible? The link to the site is http://martins.ie/newsite/. Thank you

  2. Root
    Member
    Posted 3 years ago #

    I notice yr div#media is nested inside yr php if conditional.

  3. thegreatdanton
    Member
    Posted 3 years ago #

    Hi, I put it outside the php if/else statement and the red box appears but it is below the header. Please have a look at the website now. I want it to appear to the right of the header. The php code is now:

    <div id="top">
    					<?php
    					$logotype = get_option('templatesquare_logo_type');
    					$logoimage = get_option('templatesquare_logo_image');
    					$sitename = get_option('templatesquare_site_name');
    					$tagline = get_option('templatesquare_tagline');
    					if($logoimage == ""){ $logoimage = get_bloginfo('template_url') . "/images/logo.png"; }
    					?>
    			<?php if($logotype == 'textlogo'){ ?>
    			<div id="logo">
    					<?php if($sitename=="" && $tagline==""){?>
    							<h1><a href="<?php echo get_option('home'); ?>/" title="<?php _e('Click for Home','templatesquare'); ?>"><?php bloginfo('name'); ?></a></h1>
    						<span class="desc"><?php bloginfo('description'); ?></span>
    					<?php }else{ ?>
    						<h1><a href="<?php echo get_option('home'); ?>/" title="<?php _e('Click for Home','templatesquare'); ?>"><?php echo $sitename; ?></a></h1>
    						<span class="desc"><?php echo $tagline; ?></span>
    					<?php }?>
    			</div><!-- end #logo -->
    			<?php } else { ?>
    					<div id="logo"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo $logoimage;?>" alt="" /></a></div><!-- end #logo -->
    			<?php }?>
    			<div id="media"><p>test</p></div>
    			</div><!-- end top -->
  4. Root
    Member
    Posted 3 years ago #

    there is no need to use the huge margin; thats the point of the float;
    float the 2 divs side by side, one left; one right; make sure u clear the floats after.

  5. thegreatdanton
    Member
    Posted 3 years ago #

    Thank you very much. I really appreciate your help. I've been a good few hours trying to get this sorted. I'll know now in future. Thanks again

  6. Root
    Member
    Posted 3 years ago #

    yw
    its a nice looking site

  7. thegreatdanton
    Member
    Posted 3 years ago #

    Cheers

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.