Support » Fixing WordPress » Sidebar misaligned

  • Resolved jamaaludeen

    (@jamaaludeen)


    Hi

    I did not create this WordPress website, but I’m tasked to fix some errors.

    See page: http://www.hysasystems.org/?page_id=61&goog=1

    The sidebar is at the bottom instead of on the right. Can you see the error in the code:

    <?php
    /*
    Template Name: Students Page
    */
    function checkRemoteFile($url)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url);
        // don't download content
        curl_setopt($ch, CURLOPT_NOBODY, 1);
        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if(curl_exec($ch)!==FALSE)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    ?>
    
    <?php get_header(); ?>
    <div id="aligner">
    	<div id="mainpage">
    	<div id="section1">
    
            <div id="section1a">
    		<?php if($_SESSION['theurl']=="ccr"){$thebanner="http://www.hysasystems.org/wp-content/uploads/ccr/images/bannera.png";}
    		else if($_SESSION['theurl']=="hysa"){$thebanner="http://www.hysasystems.org/wp-content/uploads/hysa/images/foldbanner.png";}
    		else if($_SESSION['theurl']=="cchange"){$thebanner="http://www.hysasystems.org/wp-content/uploads/cchange/images/titlebanner1.jpg";} ?>
             <div id="sec1amenu"> <img src="<?php echo $thebanner; ?>" style="position:absolute;left:-17px"/>
                <h1 id="heading1"><?php $tit=get_the_title(); echo $tit;?></h1></div>
    			<div style="height:2px;background-color:#B6B1A8;width:100%"></div>
                <div id="maintext" style="margin:0; margin-bottom:.5em;font-size:0.8em;"> <div>
    				<?php
    					  // The Query
    						// The Loop
    						$myloop=0;
    						$count=0;
    						for($myloop=0;$myloop<2;$myloop++){
    						$count=0;
    						 $theheader="";
    						 if($myloop==0){
    						 	$theheader="Students";
    						 }
    						 else if($myloop==1){
    						 	$theheader="Spokes";
    						 }
    
    						 echo "<div style='padding:30px 0 10px 0'><div style='float:left;width:10px;height:10px;background-color:#f15f23;padding:3px'></div><div id='theheader' style='padding:0 10px;float:left;font-weight:500'>$theheader</div><div style='clear:both'></div></div>";
    						echo "<div>";
    
    $loop = new WP_Query( array( 'post_type' => 'student' ),'posts_per_page=1000','orderby=title','order=asc' ); 
    
    						 while ( $loop->have_posts() ) : $loop->the_post();
    						 $cchangepos=get_field("cchange_list_position");
    						 $hysapos=get_field("hysa_list_position");
    						 $catpos=get_field("catcenter_list_position");
    						 $mainpos=get_field("position");
    						 if($cchangepos==""){
    						 $cchangepos=7;
    						 }
    						 if($hysapos==""){
    						 $hysapos=7;
    						 }
    						 if($catpos==""){
    						 $catpos=7;
    						 }
    						// echo $cchangepos;
    						//while ( have_posts() ) : the_post();
    							//echo get_field('student_background');
    							//$id=the_ID();
    							//echo get_field('student_background');
    							//echo $theweb;
    							//$meta = get_post_meta($post->ID, "whichweb", true);
    							$meta = get_post_meta($post->ID, "which_websites_students", true);
    							$pos=0;
    							$pos2=0;
    							$pos3=0;
    							for($i=0;$i<count($meta);$i++){
    							if($meta[$i]=="hysa"){
    							$pos=1;
    							}
    							else if($meta[$i]=="ccr"){
    							$pos2=1;
    							}
    							else if($meta[$i]=="cchange"){
    							$pos3=1;
    							}
    							//echo $meta[$i];
    							}
    							$pos=1; $pos2=0; $pos3=0;
    							if($_SESSION['theurl']=="hysa"){
    							if($pos==1){
    							if($myloop==($hysapos-1)){
    
    							$count+=1;
    							$thum=get_post_thumbnail_id();
    							$pichysa=wp_get_attachment_url($thum);
    							echo "<div style='float:left; padding:5px 2px;'>";
    							echo "<a href='".get_permalink()."' style='text-decoration:none'>";
    							echo "<div style='width:142px;min-height:212px;padding:1px; background-color:#eeeeee'>";
    							$remfile=checkRemoteFile($pichysa);
    							if(!$remfile){
    							$pichysa="http://www.hysasystems.org/wp-content/themes/hysa-wordpress/default_user_icon.jpg";
    							}
    							echo "<img src='http://www.hysasystems.org/wp-content/themes/hysa_wordpress/timthumb/timthumb.php?src=$pichysa&w=142&h=192' />";
    							echo '<br>';
    							echo "<div style='text-align:center;color:#f15f23;padding:10px;'>";
    							//echo get_permalink();
    							echo the_title();
    							echo '<br>';
    							echo "</div>";
    							echo "</div>";
    							echo "</a>";
    							echo "</div>";
    							if(($count%4==0)&&($count!=0)){
    							echo "<div style='clear:both'></div>";
    								echo "</div><div style='height:20px;width:10px'></div><div>";
    							}
    							}
    							}
    							}
    							else if($_SESSION['theurl']=="ccr"){
    							if($pos2==1){
    							if($myloop==($catpos-1)){
    							$count+=1;
    
    							$thum=get_post_thumbnail_id();
    							$pichysa=wp_get_attachment_url($thum);
    							echo "<div style='float:left; padding:5px 2px;'>";
    							$perm= get_permalink();
    							$perm1=explode("?",$perm);
    							$perm2="http://www.catcentre.uct.ac.za/?".$perm1[1];
    							echo "<a href='".$perm2."' style='text-decoration:none'>";
    							echo "<div style='width:142px;min-height:212px;padding:1px; background-color:#eeeeee'>";
    							echo "<img src='http://www.hysasystems.org/wp-content/themes/hysa_wordpress/timthumb/timthumb.php?src=$pichysa&w=142&h=192' />";
    							echo '<br>';
    							echo "<div style='text-align:center;color:#336699;padding:10px;'>";
    							//echo get_permalink();
    							echo the_title();
    							echo '<br>';
    							echo "</div>";
    							echo "</div>";
    							echo "</a>";
    							echo "</div>";
    							if(($count%4==0)&&($count!=0)){
    							echo "<div style='clear:both'></div>";
    								echo "</div><div style='height:20px'></div><div>";
    							}
    							}
    							}
    							}
    							else if($_SESSION['theurl']=="cchange"){
    							if($pos3==1){
    							if($myloop==($cchangepos-1)){
    							$count+=1;
    
    							$thum=get_post_thumbnail_id();
    							$pichysa=wp_get_attachment_url($thum);
    							echo "<div style='float:left; padding:5px 2px;'>";
    							$perm= get_permalink();
    							$perm1=explode("?",$perm);
    							$perm2="http://www.cchange.ac.za/?".$perm1[1];
    							echo "<a href='".$perm2."' style='text-decoration:none'>";
    							echo "<div id='mypicbox' style='width:142px;min-height:212px;padding:1px; background-color:#eeeeee'>";
    							echo "<img src='http://www.hysasystems.org/wp-content/themes/hysa_wordpress/timthumb/timthumb.php?src=$pichysa&w=142&h=192' width='142px' height='192px' />";
    							//the_post_thumbnail();
    							echo '<br>';
    							echo "<div style='bottom:0;text-align:center;color:#c92e2f;padding:10px;'>";
    							//echo get_permalink();
    							echo the_title();
    							echo '<br>';
    							echo "</div>";
    							echo "</div>";
    							echo "</a>";
    							echo "</div>";
    							if(($count%4==0)&&($count!=0)){
    							echo "<div style='clear:both'></div>";
    								echo "</div><div style='height:20px'></div><div>";
    							}
    							}
    							}
    							}
    						endwhile;
    
    						// Reset Query
    						wp_reset_query();
    						}
    				?>
    				</div>
    			  </div>
              </div>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 15 replies - 1 through 15 (of 19 total)
Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Sidebar misaligned’ is closed to new replies.