Conditionally including a php file in the template
-
Hi.
I need to load an ad at certain intervals on index pages, and I’m trying this code:<?php /* Start the Loop */ ?> <?php $count = 0 ; /* Setting count to zero for ads interval */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php /* Getting the minibanner ad at certain intervals along the list of entries down the page */ $count= $count+1; if($count(array('1', '5', '10', '15', true))) { include("ads/minibanner.php") ; } ; ?> <?php endwhile; ?>
This gives me a “Fatal error: Function name must be a string in /mounted-storage/…” and so on, indicating line 33 which is this line:
if($count(array('1', '5', '10', '15', true))) { include("ads/minibanner.php") ; } ; ?>
This is in the twentyeleven theme, slightly modified but have left the functions.php file alone so far.
Any pointers?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Conditionally including a php file in the template’ is closed to new replies.