0

I need to say if the number of published posts is only one, get_footer();... but.. if the number of published posts is greater than one, get_footer('single')..

This is my current code that doesn't seem to work:

<?php

 $count_posts = wp_count_posts();

  if($count_posts = 1){
     get_footer();
 } else if($count_posts > 1) {
     get_footer('single');
 }

?>
4

1 回答 1

1

=执行一个任务,所以这个:

if($count_posts = 1){

...基本上与此相同:

$count_posts = 1;
if($count_posts) {

您很可能想要进行比较而不是分配:

if($count_posts == 1){
于 2013-06-12T04:10:17.350 回答