Bir php dosyamda şöyle bir hata alıyorum;
PHP dosyasını sadece wordpressteki yazıları listelemek için kullanıyorum.
Hata;
mod_fcgid: stderr: PHP Parse error: syntax error, unexpected 'endforeach' (T_ENDFOREACH) in /var/www/vhosts/........./httpdocs/ozgunyorum.php on line 17
Kodlar;
<?php
include('wp-load.php');
$sayfa = $_GET['islem'];
$kacYazi = $_GET['kacYazi'];
if ($sayfa == 'yorumAl') {
$args = array( 'posts_per_page' => 1, 'orderby' => 'rand' );
$rand_posts = get_posts( $args );
foreach ( $rand_posts as $post ) :
setup_postdata( $post );
?><ozgunYorum>
<link><?php the_permalink(); ?></link>
<baslik><?php the_title(); ?></baslik>
<id><?php the_id() ?></id>
</ozgunYorum><?php
endforeach;
wp_reset_postdata();
}
if ($sayfa == 'tumYazilar') {
query_posts('showposts='.$kacYazi);
if (have_posts()) : while (have_posts()) : the_post();
?><ozgunYorum>
<link><?php the_permalink(); ?></link>
<baslik><?php the_title(); ?></baslik>
<id><?php the_id() ?></id>
</ozgunYorum><?php
endwhile;
endif;
}
?>