2017-11-16 7 views
1

に私には、例えば、iframeのURLを作成する必要はありません。ローカルホストでのクエリの仕事が、ライブ

https://url.com/category/{category_name)/t=desktop || /t=mobile. 

私は私の地元のdevのENVを実行するためにMAMPを使用していますし、それがあるべきように私はそれ働いてしまいました、クエリ文字列がデスクトップと等しい場合は、3つの投稿を表示し、モバイルの場合は1つの投稿のみを表示します。今の問題は、システム管理者が事前にライブのenvを更新しているとき、彼はログからこのエラーを見ることができ、以下の通りです:

[Wed Nov 15 20:09:42.122140 2017] [:error] [pid 7776] [client 10.1.2.66:41696] PHP Parse error: syntax error, unexpected end of file, expecting elseif (T_ELSEIF) or else (T_ELSE) or endif (T_ENDIF) in /var/lib/wordpress/wp-content/themes/wpTheme2/single_iframe.php on line 234 

シングルiframe.phpフルコード:https://pastebin.com/MBC6thDW

私はテストを行くことにしようとしていますurl私はどちらかのエラー500を取得しているまたは単にクエリ機能を持つヘッダーが表示されます。

私はPhpStorm IDEを使用していますが、私のコードには何も表示されません。

+0

エラーログファイルを確認し、このエラーについての書き込み内容を読む必要があります。エラーメッセージが表示された場合は、問題を解決するのが簡単になります –

+0

https://pastebin.com/77yxK1A7 - 完全なエラーログです。実際に表示されている行は正しいものですが、IDEを削除するとIDEが表示されません。 – fl0bey

+1

$ queried_object = get_queried_object();ツリータイム)他にも.sponsored-textで見つかっただけでなく、なぜ同じコードが多いのでしょうか? –

答えて

1

は、それが原因shorttagsである

https://pastebin.com/7ubTY2A4

<?php 
if (! defined('ABSPATH')) { 
    exit; 
} 
?> 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> 
    <meta name="description" content="<?php bloginfo('description'); ?>"> 
    <?php 
    if(get_field('fav_icon', 'option') != ''){ 
     $favId = get_field('fav_icon', 'option'); 
     $favDetails = wp_get_attachment_image_src($favId, 'full'); 
    } 
    ?> 
    <?php if(!empty($favDetails)): ?> 
     <link rel="shortcut icon" href="<?php echo $favDetails[0]; ?>"> 
    <?php endif;?> 




    <title><?php wp_title();?></title> 


    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> 


    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
    <!--[if lt IE 9]> 
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> 
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> 
    <![endif]--> 
    <?php wp_head(); ?> 
    <!--[if (lt IE 9)&(!IEMobile)]> 
    <link rel="stylesheet" type="text/css" href="enhanced.css" /> 
    <link rel="stylesheet" type="text/css" href="iframe.css" /> 
    <![endif]--> 
    <?php 
    if(is_front_page()){ 
     $info = get_bloginfo('description'); 

     echo '<meta name="og:description" content="'.$info.'">'; 
     echo '<meta name="og:title" content="Website">'; 
    } 
    ?> 
    <style> 
     .main-header--frame { 
      background-color: #a40057; 
      margin-bottom: -40px; 
     } 
     .main-header--frame .categoryTitle { 
      display: inline-block; 
      padding-top: 19px; 
      padding-left: 10px; 
      color: #ffffff; 
     } 

     .main-header.main-header--frame .container { 
      max-width: 1200px; 
      background-color: transparent; 
     } 

    </style> 

</head> 
<body> 
<header class="main-header main-header--frame"> 
    <nav> 
     <div class="container"> 
      <div class="navbar-header"> 
       <a href="https://stiil.ee" class="navbar-brand"> 
        <img src="logo" alt="logo" 
         class="img-responsive"> 
       </a> 
       <h1 class="categoryTitle">Description</h1> 
      </div> 
     </div> 
    </nav> 
</header> 
<main class="main-content main-content-inner valitud-content-inner"> 
    <div class="container"> 
      <?php 
      $queried_object = get_queried_object(); 
      $taxChilds = get_terms(array(
        'taxonomy' => 'category', 
        'hide_empty' => true, 
        'child_of' => $queried_object->term_id 
      )); ?> 

      <?php if(isset($_GET) && $_GET['t'] == 'desktop'): ?> 
       <div class="category-wrap"> 
          <?php 
          $queried_object = get_queried_object(); 
          $count =0; 
          foreach($taxChilds as $taxChild): ?> 
           <?php 
           $args = array(
             'post_type'=> 'post', 
             'cat' => $taxChild->slug, 
             'posts_per_page' => '1', 
             'orderby' => 'rand', 

             'tax_query' => array(
               array(
                 'taxonomy' => 'category', 
                 'field' => 'term_id', 
                 'hide_empty' => false, 
                 'terms' => $taxChild->term_id, 
               ), 
             ) 
           ); 
           query_posts($args); if(have_posts()): 
            while(have_posts()): the_post(); ?> 
             <div class="col-md-4 all itemz <?php echo $taxChild->slug; ?>" data-cat="<?php echo $taxChild->slug; ?>"> 
              <div class="item-wrap"> 
               <a href="<?php the_permalink();?>"><?php the_post_thumbnail('size-370x416'); 
                       $sponsored = get_field('is_sponsored_content'); 
                       if($sponsored){ 
                        echo '<div class="sponsored-text">Ad</div>'; 
                       }; 
                       ?></a> 
               <div class="overlay"> 
                <div class="notify"> 
                 <a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_cat_img_src();?>" alt=""></a> 
                </div> 
                <h2 class="categoryTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 
               </div> 
              </div> 
             </div> 
            <?php endwhile; 

           endif; wp_reset_query();?> 
           <?php 
           if ($count == 2) { 
            break; 
           } 
           ?> 
           <?php $count++; endforeach;?> 
       </div> 
      <?php endif; ?> 

      <?php if(isset($_GET) && $_GET['t'] == 'mobile'): ?> 
       <div class="category-wrap"> 
          <?php 
          $queried_object = get_queried_object(); 
          $count =0; foreach($taxChilds as $taxChild): ?> 
           <?php 
           $args = array(
             'post_type'=> 'post', 
             'cat' => $taxChild->slug, 
             'posts_per_page' => '1', 
             'orderby' => 'rand', 

             'tax_query' => array(
               array(
                 'taxonomy' => 'category', 
                 'field' => 'term_id', 
                 'hide_empty' => false, 
                 'terms' => $taxChild->term_id, 
               ), 
             ) 
           ); 
           query_posts($args); 
           if(have_posts()): 
            while(have_posts()): the_post(); ?> 
           <div class="col-md-4 all itemz <?php echo $taxChild->slug; ?>" data-cat="<?php echo $taxChild->slug; ?>"> 
            <div class="item-wrap"> 
             <a href="<?php the_permalink();?>"><?php the_post_thumbnail('size-370x416'); 
                     $sponsored = get_field('is_sponsored_content'); 
                     if($sponsored){ 
                      echo '<div class="sponsored-text">SISUTURUNDUS</div>'; 
                     }; 
                     ?></a> 
             <div class="overlay"> 
              <div class="notify"> 
               <a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_cat_img_src();?>" alt=""></a> 
              </div> 
              <h2 class="categoryTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> 
             </div> 
            </div> 
           </div> 
           <?php endwhile; 
           endif; wp_reset_query();?> 
           <?php 
           if ($count == 0) { 
            break; 
           } 
           ?> 
           <?php $count++; endforeach;?> 
       </div> 
      <?php endif; ?> 

    </div> 
</main> 
</body> 

<!--main-content ends--> 
<?php wp_footer(); ?> 
+2

'<?php endif;の代わりに' 'を使用しました。 ?> ' – vel

+0

さて、ありがとう、私は一瞬でそれを試してみましょう。 – fl0bey

+1

その作業は... – vel

2

このコードを試してみてください。 ローカルホスト環境で「<?」を使用していますか?が有効になっている場合、開発サーバーでは有効になっていません。それが唯一の理由です。

http://php.net/manual/en/language.basic-syntax.phptags.php

だから、単に "<の?" 置き換えます「<?php」と入力しても問題ありません。

+0

私は開発サーバーのsysadminと実際に話しました、問題は、迅速な返信のおかげで再び。皆さんありがとう、私はすぐにこのバグを消し去ることに成功しました。 :) – fl0bey

関連する問題