I'm working on a website. I'm usng page.php to control all the pages even though they have different categories. All was ok on my local server (XAMPP), I could view all the pages, but when I uploaded online, I got parse error while trying to view the pages.
I did not want to create individual files for all the pages so I decided to place all in page.php using the if ( is_page( page_id )
Here is the error I got:
Parse error: syntax error, unexpected 'endwhile' (T_ENDWHILE) in /----/http://ift.tt/2fRMnPn on line 1
Checkout the site via: www.woodclef.com Password is 12345678
Here is page.php codes giving the error
<?php
//Highlights
if ( is_page( 10 ) ) {
$args = array(
'posts_per_page' => -1,
'cat' => 5
);
$sticky_query = new WP_Query( $args );
$count = 0;
while ( $sticky_query->have_posts() ) : $sticky_query->the_post(); ?>
<?php $count++;
if ($count == 1) : ?>
<?php get_template_part( 'pages/common_template_a' );
elseif ($count == 2) : ?>
<?php get_template_part( 'pages/common_template_a' ); ?>
<?php else : ?>
<?php get_template_part( 'pages/common_template' );
endif;
endwhile;
wp_reset_postdata();
}
//News
if ( is_page( 144 ) ) {
$args = array(
'posts_per_page' => -1,
'cat' => 6
);
$sticky_query = new WP_Query( $args );
$count = 0;
while ( $sticky_query->have_posts() ) : $sticky_query->the_post(); ?>
<?php $count++;
if ($count == 1) : ?>
<?php get_template_part( 'pages/common_template_a' );
elseif ($count == 2) : ?>
<?php get_template_part( 'pages/common_template_a' ); ?>
<?php else : ?>
<?php get_template_part( 'pages/common_template' );
endif;
endwhile;
wp_reset_postdata();
}
?>
Aucun commentaire:
Enregistrer un commentaire