0
私は(例えば、私は、これはユーザーのページにある場合は、それらが全体の構造を囲むようにしたくない)特定のページにのみ表示されるように、以下のif文をしたい:php if文を別のif文に適用しますか?
<div class="mainbar">
<?php if /* I don't want this and... */ (bbp_has_topics($bbp_loop_args)) : ?>
<?php while (bbp_topics()) : bbp_the_topic(); ?>
<div class="topic-wrapper">
<div class="topic-left">
<h2><a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a></h2>
<span><?php printf(__('Started by: %1$s', 'bbpress'), bbp_get_topic_author_link(array('size' => '14'))); ?></span>
<?php if (!bbp_is_forum() || (bbp_get_topic_forum_id() != bbp_get_forum_id())) : ?>
<span class="bbp-topic-started-in"><?php printf(__('in: <a href="%1$s">%2$s</a>', 'bbpress'), bbp_get_forum_permalink(bbp_get_topic_forum_id()), bbp_get_forum_title(bbp_get_topic_forum_id())); ?></span>
<?php endif; ?>
<?php bbp_topic_tag_list(); ?>
</div><!-- #topic-left -->
<div class="topic-right">
<div class="topic-like-count">
<h4><?php // bbp_topic_reply_count(); ?><?php if(function_exists('the_ratings')) { the_ratings(); } ?></h4>
<span><?php _e('likes'); ?></span>
</div>
<div class="topic-reply-count">
<h4><?php bbp_topic_reply_count(); ?></h4>
<span><?php _e('replies'); ?></span>
</div>
<div class="topic-freshness">
<h4><?php bbp_topic_freshness_link(); ?></h4>
<span>
<?php bbp_author_link(array('post_id' => bbp_get_topic_last_active_id(), 'size' => 14)); ?>
</span>
</div>
</div><!-- #topic-right -->
</div><!-- #topic -->
<?php /* this to appear in an user page */ endwhile; ?>
<?php endif; ?>
</div><!-- #mainbar -->
これはif文である私は上記のif文がユーザーページ内の構造全体を囲んでいないことを確認する必要があります。
<?php if (! is_single('user')) : ?>
<?php endif; ?>
しかし、私はどのように配置するのか分かりません。
提案がありますか?私が正しくあなたを理解していれば
申し訳ありませんが、私はあなたが意味することを理解していません。 – phant0m
@ phant0m ifステートメント '<?php while(bbp_topics()):bbp_the_topic(); ?> 'は特定のページでのみ構造全体を囲むべきではありません。構造体にif文がない場合にのみ動作するページもあります。 – alexchenco
"if文:while" - while文は何ですか?だから、基本的には、特定のコントロール構造が特定のページでしか動作しないようにしたい。あなたはそれらをチェックする必要があります。 'if(in_array($ site、$ allowed_sites)&&())'のように、許可されたサイトの配列と現在のサイトの変数があるとします。 –
phant0m