Php Alignment Issues ... Ahhh

Discussion in 'PHP' started by Overseas, Feb 1, 2013.

  1. #1
    Pulling my hair out (what little i have left) ;)

    Having issues with our new theme - we are trying to add the drop down menu for the translation widget under the social icons at the top of the page.

    This is the section <?php do_action('icl_language_selector'); ?>
    (highlighted in red)

    we want it placed -- See image
    [​IMG]


    php header code below:

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title>
    <?php wp_title('-', true, 'right'); ?>
    <?php bloginfo('name'); ?>
    </title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php get_template_part('header', 'CSS'); ?>
    <?php wp_head(); ?>
    </head>
    <body id="body" <?php body_class(); ?>>

    <!-- #site-container -->
    <div id="site-container">

    <!-- #header -->
    <header id="header" class="clearfix">


    <!-- #logo -->
    <div id="logo">
    <?php if (is_front_page()) { ?><h1><?php } ?>
    <a title="<?php bloginfo( 'name' ); ?>" href="<?php echo home_url(); ?>">
    <?php if (of_get_option('st_logo')) { ?>
    <img alt="<?php bloginfo( 'name' ); ?>" src="<?php echo of_get_option('st_logo'); ?>">
    <?php } else { ?>
    <?php bloginfo( 'name' ); ?>
    <?php } ?>
    </a>
    <?php if (is_front_page()) { ?></h1><?php } ?>
    </div>
    <!-- /#logo -->

    <!-- #social -->
    <?php if (
    of_get_option('st_social_email') ||
    of_get_option('st_social_facebook') ||
    of_get_option('st_social_twitter')||
    of_get_option('st_social_google') ||
    of_get_option('st_social_behance') ||
    of_get_option('st_social_forrst') ||
    of_get_option('st_social_linkedin') ||
    of_get_option('st_social_dribbble') ||
    of_get_option('st_social_skype') ||
    of_get_option('st_social_flickr') ||
    of_get_option('st_social_vimeo') ||
    of_get_option('st_social_youtube') ||
    of_get_option('st_social_rss') == '1' ) { ?>
    <ul class="social clearfix">
    <?php if (of_get_option('st_social_rss') == '1') { ?> <li class="rss"><a target="_blank" href="<?php bloginfo( 'rss2_url' ); ?>">RSS</a></li><?php } ?>
    <?php if (of_get_option('st_social_facebook')) { ?><li class="facebook"><a target="_blank" href="<?php echo of_get_option('st_social_facebook'); ?>">Facebook</a></li><?php } ?>
    <?php if (of_get_option('st_social_twitter')) { ?><li class="twitter"><a target="_blank" href="<?php echo of_get_option('st_social_twitter'); ?>">Twitter</a></li><?php } ?>
    <?php if (of_get_option('st_social_google')) { ?><li class="google"><a target="_blank" href="<?php echo of_get_option('st_social_google'); ?>">Google+</a></li><?php } ?>
    <?php if (of_get_option('st_social_behance')) { ?><li class="behance"><a target="_blank" href="<?php echo of_get_option('st_social_behance'); ?>">Behance</a></li><?php } ?>
    <?php if (of_get_option('st_social_pinterest')) { ?><li class="pinterest"><a target="_blank" href="<?php echo of_get_option('st_social_pinterest'); ?>">Pinterest</a></li><?php } ?>
    <?php if (of_get_option('st_social_forrst')) { ?><li class="forrst"><a target="_blank" href="<?php echo of_get_option('st_social_forrst'); ?>">Forrst</a></li><?php } ?>
    <?php if (of_get_option('st_social_linkedin')) { ?><li class="linkedin"><a target="_blank" href="<?php echo of_get_option('st_social_linkedin'); ?>">LinkedIn</a></li><?php } ?>
    <?php if (of_get_option('st_social_dribbble')) { ?><li class="dribbble"><a target="_blank" href="<?php echo of_get_option('st_social_dribbble'); ?>">Dribbble</a></li><?php } ?>
    <?php if (of_get_option('st_social_skype')) { ?><li class="skype"><a target="_blank" href="<?php echo of_get_option('st_social_skype'); ?>">Skype</a></li><?php } ?>
    <?php if (of_get_option('st_social_flickr')) { ?><li class="flickr"><a target="_blank" href="<?php echo of_get_option('st_social_flickr'); ?>">Flickr</a></li><?php } ?>
    <?php if (of_get_option('st_social_vimeo')) { ?><li class="vimeo"><a target="_blank" href="<?php echo of_get_option('st_social_vimeo'); ?>">Vimeo</a></li><?php } ?>
    <?php if (of_get_option('st_social_youtube')) { ?><li class="youtube"><a target="_blank" href="<?php echo of_get_option('st_social_youtube'); ?>">YouTube</a></li><?php } ?>
    </ul>
    <?php } ?>


    <?php do_action('icl_language_selector'); ?>

    <!-- /#social -->



    </header>
    <!-- /#header -->


    <!-- #primary-nav -->
    <nav id="primary-nav" role="navigation" class="clearfix">
    <?php if ( has_nav_menu( 'primary-nav' ) ) { ?>
    <?php wp_nav_menu( array('theme_location' => 'primary-nav', 'container' => false, 'menu_class' => 'nav sf-menu clearfix' )); ?>
    <?php dropdown_menu( array('theme_location' => 'primary-nav', 'container' => false )) ?>
    <?php } else { ?>
    <ul>
    <?php echo wp_list_pages( array( 'title_li' => '' ) ); ?>
    </ul>
    <?php } ?>

    </nav>
    <!-- #primary-nav -->


    Your kind help would be appreciated.

    // OVERSEAS
     
    Overseas, Feb 1, 2013 IP
  2. tiamak

    tiamak Active Member

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    3
    Trophy Points:
    58
    #2
    hmm
    have your tried something like:
    <div style="float:right"><?php do_action('icl_language_selector'); ?></div>
     
    tiamak, Feb 1, 2013 IP
  3. Overseas

    Overseas Well-Known Member

    Messages:
    1,098
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    140
    #3
    Hey thanks that's helped, we missed the ":"
    Thanks buddy
     
    Overseas, Feb 1, 2013 IP
  4. tiamak

    tiamak Active Member

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    3
    Trophy Points:
    58
    #4
    n/p :D
    if you ever need paid WP support then let me know ;)
     
    tiamak, Feb 1, 2013 IP
  5. ArMouR

    ArMouR Well-Known Member

    Messages:
    161
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #5
    You can also add the margin-left and / or margin-right in the css code if you want to shift it in perfect alignment if it doesn't align perfectly under the social icons. Good luck with your new theme! ;)
     
    ArMouR, Feb 1, 2013 IP
  6. Overseas

    Overseas Well-Known Member

    Messages:
    1,098
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Thanks guys for your help... Job is finished now.
     
    Overseas, Feb 2, 2013 IP
  7. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #7
    Shame job is finished -- you really were doing things the hard way:

    
    $socials = array(
    	'email','RSS','Facebook','Google','Pinterest','Forrst',
    	'LinkedIn','Dribble','Skype','Flickr','Vimeo','youtube'
    );
    	
    $socialValues = array();
    $socialValues = array();
    foreach ($socials as $name) {
    	$tName='st_social_'.strtolower($name);
    	if (of_get_option($tName)) $socialValues[$name]=of_get_option($tName)
    }
    if (count($socialValues) > 0) {
    	echo '
    		<ul class="social">';
    		foreach ($socialValues as $name => $value) {
    			echo '
    			<li class="',strtolower($name),'">
    				<a href="',$value,'">',$name,'</a>
    			</li>';
    		}
    	echo '
    		</ul>';
    }
    Code (markup):
    If you feel like you're repeating the same thing over and over for no reason, guess what!?!

    Of course, I'd also swing an axe at the HTML 5 garbage while in there, naturally I got rid of 'target' since that has no business on any website written after 1998, and I'd probably replace that entire MESS up in the header too... since where you have this:

    
    <!-- #header -->
     <header id="header" class="clearfix">
    
    
     <!-- #logo -->
     <div id="logo">
     <?php if (is_front_page()) { ?><h1><?php } ?>
     <a title="<?php bloginfo( 'name' ); ?>" href="<?php echo home_url(); ?>">
     <?php if (of_get_option('st_logo')) { ?>
     <img alt="<?php bloginfo( 'name' ); ?>" src="<?php echo of_get_option('st_logo'); ?>">
     <?php } else { ?>
     <?php bloginfo( 'name' ); ?>
     <?php } ?>
     </a>
     <?php if (is_front_page()) { ?></h1><?php } ?>
     </div>
     <!-- /#logo -->
    
    Code (markup):
    I'd probably have something more like this:

    
    echo '
    	<h1>
    		<a href="',home_url(),'">
    			<span><!-- image replacement --></span>
    			',bloginfo('name'),'
    		</a>
    	</h1>';
    
    Code (markup):
    Since the H1 is the heading under which everything on the page is a subsection (which is why the site name/title/logo is the only real candidate for it no matter what the SEO voodoo whackjobs try to tell you), and any 'logo' is presentation and has such has little if any business in the HTML. (the ONLY reason for the span is IE7 being a dick about depth-sorting :before and :after) - which said span would be gilder-levin style put over the text hiding it -- and of course since you'd have actual text inside the anchor, there's no reasoon to waste time putting a title on it... or the extra DIV for nothing around it, etc, etc...

    WP devs man... absolutely terrifying.
     
    Last edited: Feb 2, 2013
    deathshadow, Feb 2, 2013 IP