以下if语句有3个条件:
<?php if ( is_archive() ) : ?>
<?php $topic_tag_term = get_query_var( 'term' ); ?>
<?php // Display the top topics of current forum
$args = array(
'post_type' => 'topic',
'posts_per_page' => '3',
'topic-tag' => $topic_tag_term,
'r_sortby' => 'highest_rated',
'r_orderby' => 'desc',
'order' => 'DESC'
);
?>
<?php $term = $wp_query->queried_object; ?>
<p>The following are a list of topic tagged as <strong><?php echo $term->name ?></strong>.</p>
<?php if ( bbp_current_user_can_access_create_topic_form() ) : ?>
<a id="new-entry" href="<?php echo home_url( '/' ); ?>/create-topic">Start a new topic</a>
<?php endif; ?>
<?php if ( is_page_template() ) : ?>
<?php // Display the top topics of current forum
$args = array(
'post_type' => 'topic',
'posts_per_page' => '3',
'r_sortby' => 'highest_rated',
'r_orderby' => 'desc',
'order' => 'DESC',
'meta_key' => '_bbp_reply_count',
'meta_value' => '1',
'meta_compare' => '<'
);
?>
<?php else : ?>
<?php // Display the top topics of current forum
$args = array(
'post_type' => 'topic',
'posts_per_page' => '3',
'post_parent' => $post->ID,
'r_sortby' => 'highest_rated',
'r_orderby' => 'desc',
'order' => 'DESC'
);
?>
<?php endif; ?>
由于某种原因,这段代码打破了我的页面。
它出了什么问题?
答案 0 :(得分:5)
<?php if ( is_page_template() ) : ?>
应该是
<?php elseif ( is_page_template() ) : ?>
至少这是我能看到的错误。
答案 1 :(得分:1)
答案 2 :(得分:0)
此行最后没有半冒号。
<strong><?php echo $term->name ?></strong>