2017-04-13 77 views
-1

同事請幫我修復這段代碼我不是程序員。解析錯誤:語法錯誤,意外的'其他'(T_ELSE)第12行的archive.php

Parse error: syntax error, unexpected 'else' (T_ELSE) in blog/public_html/wp-content/themes/munding-lite/archive.php on line 12

<!DOCTYPE html> 
<!--[if lt IE 7 ]><html class="ie ie6" <?php language_attributes(); ?>> <![endif]--> 
<!--[if IE 7 ]><html class="ie ie7" <?php language_attributes(); ?>> <![endif]--> 
<!--[if IE 8 ]><html class="ie ie8" <?php language_attributes(); ?>> <![endif]--> 
<!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?> > <!--<![endif]--> 

<head> 
<meta charset="<?php bloginfo('charset'); ?>"> 
<!--[if ie]><meta http-equiv='X-UA-Compatible' content="IE=edge,IE=9,IE=8,chrome=1" /><![endif]--> 
<meta name="description" content=""> 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> 

<?php wp_head(); ?> 

</head> 

<body <?php body_class() ;?>> 

<div id="preloader"> 
    <div id="status">&nbsp;</div> 
</div> 

<?php 
$logo_id  = get_theme_mod('custom_logo'); 
$logo_image = wp_get_attachment_image_src($logo_id, 'full'); 
?> 

<div class="container"> 

    <header id="header" class="header col-md-10 col-md-push-1 clearfix"> 
     <a id="mobile-menu" class="pull-left"><i class="icon icon-content-43"></i></a> 

     <div class="logo pull-left"> 
      <?php if (! empty($logo_image)) { ?> 
      <div class="logo-image"> 
       <?php echo '<a href="' . esc_url(home_url()) . '"><img src="' . esc_url($logo_image[0]) . '" /></a>'; ?> 
      </div> 
      <?php } 
      else { ?> 
      <h1 class="site-title"> 
       <a href="<?php echo esc_url(home_url()); ?>" title="<?php echo esc_attr(get_bloginfo('name')); ?>" class="header-logo"><?php echo esc_html(get_bloginfo('name')); ?></a> 
      </h1> 
      <?php } ?> 
     </div><!-- logo --> 
     <nav id="mainmenu" class="menu pull-right clearfix"> 
      <?php munding_lite_top_nav_menu(); ?> 
     </nav> 

    </header> 

</div> 

<div id="main" class="site-main clearfix"> 

Parse error: syntax error, unexpected 'else' (T_ELSE) in blog/public_html/wp-content/themes/munding-lite/archive.php on line 12

<?php get_header(); ?> 

     <div id="content-wrapper" class="wrapper"> 

      <?php while (have_posts()) : the_post(); 


        get_template_part('inc/format/loop', get_post_format()); 

       endwhile; ?> 

      <?php else : ?> 
      <?php get_template_part('inc/format/loop', 'no-result'); ?> 

      <?php endif; ?> 

     </div><!-- wrapper --> 
     <div class="container"> 
     <div class="pagina col-md-10 col-md-push-1"> 
      <?php munding_lite_content_nav('nav-below'); ?> 
     </div> 
     </div> 


<?php get_footer(); ?> 

回答

0

錯過了如果(have_post()):在同時上述(have_post()):the_post();

試試這個會適合你。

<div id="content-wrapper" class="wrapper"> 

     <?php if(have_posts()): 
       while (have_posts()) : the_post(); 


       get_template_part('inc/format/loop', get_post_format()); 

      endwhile; ?> 

     <?php else : ?> 
     <?php get_template_part('inc/format/loop', 'no-result'); ?> 

     <?php endif; ?> 

    </div><!-- wrapper --> 
    <div class="container"> 
    <div class="pagina col-md-10 col-md-push-1"> 
     <?php munding_lite_content_nav('nav-below'); ?> 
    </div> 
    </div> 
+0

工程罰款感謝:) – Tomasz

+0

歡迎您托馬斯:) –