需要帮助格式化Wordpress网站的PHP条件语句


Need help formatting PHP conditional statement for Wordpress website

这是未经编辑的原始代码,用于检查主题选项中是否选择了摘录或完整内容。

<?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] == 'content' ) { the_content( __( 'Continue Reading &rarr;', 'woothemes' ) ); } else { the_excerpt(); } ?>

我想把<?php if (is_home() ) { <?php the_content(); ?>添加到这句话的开头,这样主页总是显示完整的帖子。

我尝试了以下方法,但不起作用:

<?php if (is_home()) { ?> <?php the_content(); ?> elseif ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] == 'content' ) { the_content( __( 'Continue Reading &rarr;', 'woothemes' ) ); } else { the_excerpt(); }} ?>

正如我所看到的,您只需添加一些额外的php引号:

<?php 
if (is_home()) { the_content(); 
} elseif ( isset( $woo_options['woo_post_content'] )  && $woo_options['woo_post_content'] == 'content' ) { 
  the_content( __( 'Continue Reading &rarr;', 'woothemes' ) );
} else { 
    the_excerpt(); 
} 
?>