-2

ifステートメントをステートメント内に配置するのに少し問題がありますif。例:

<?php
$steponeimage = get_post_meta($post->ID, 'step_one_image', true);
$steponecontent = get_post_meta($post->ID, 'step_one_content', true);
$steptwoimage = get_post_meta($post->ID, 'step_two_image', true);
$steptwocontent = get_post_meta($post->ID, 'step_two_content', true);
$stepthreeimage = get_post_meta($post->ID, 'step_three_image', true);
$stepthreecontent = get_post_meta($post->ID, 'step_3_content', true);
if ($steponecontent) {
?>
<div id="processPanel" class="panel">
    <a href="#content1" label="1">Step 1</a>
<?php if ($steptwocontent) { ?>
<a href="#content2" label="2">Step Two</a>
<?php } else { ?><?php } ?>
<?php if ($stepthreecontent) { ?>
<a href="#content3" label="3">Step Three</a>
<?php } else { ?><?php } ?>
    <div id="content1">
<p><?php $images1 = $helper->imageDisplay($steponeimage , $height , $width , true , $ar[0] , false, false,'' ,'' ,false);
echo "<div class='imageholder'> $images1 </div>"; ?></p>
<p><?php echo $steponecontent; ?></p>
</div>
<?php if ($steptwocontent); { ?>
<div id="content2">
<p><?php $images2 = $helper->imageDisplay($steptwoimage , $height , $width , true , $ar[0] , false, false,'' ,'' ,false);
echo "<div class='imageholder'> $images2 </div>"; ?></p>
<p><?php echo $steptwocontent; ?></p>
</div><?php } else { ?><?php } ?>
<?php if ($stepthreecontent); { ?>
<div id="content3">
<p><?php $images3 = $helper->imageDisplay($stepthreeimage , $height , $width , true , $ar[0] , false, false,'' ,'' ,false);
echo "<div class='imageholder'> $images3 </div>"; ?></p>
<p><?php echo $stepthreecontent; ?></p>
</div><?php } else { ?><?php } ?>
</div>
<?php } else { ?>
<?php } ?>

ワードプレスの投稿から投稿のメタデータを読み込もうとしています。ステップ1のメタボックスが入力されている場合は、ステップバイステップの情報が表示されます。ステップ2のメタボックスが入力されている場合は、そこにステップ2が追加され、ステップ3のボックスがそれを埋めて、ステップ3などを追加します。

私のエラーは

解析エラー:構文エラー、予期しないT_ELSE

これはここから来ています:

<p><?php echo $steptwocontent; ?></p>
</div><?php } else { ?><?php } ?>
4

1 に答える 1

3

これがあなたの問題です:

if ($steptwocontent); {

に変更します

if ($steptwocontent) {

編集:

stepthreecontentでも同じことをしたことに気づきました

変化する

if ($stepthreecontent); {

if ($stepthreecontent) {
于 2012-05-19T11:24:42.727 に答える