我希望此函数仅在某些页面上返回。我该怎么做?
// Retreats Accordion
function retreats_accordion() {
?>
<!-- accordion root -->
<div id="accordion">
<?php
global $post;
$c = 0;
$class = \'\';
$args = array( \'posts_per_page\' => 6, \'post_type\'=> \'slide\', \'slideshow\'=> \'retreats\');
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post);
$c++;
if( $c == 6 ) $class .= \' last\'; ?>
<a href="<?php echo get_post_meta($post->ID, "slide_url_value", true); ?>">
<?php the_post_thumbnail(\'quickfinder\'); ?>
</a>
<div class="slide<?php echo $class;?>" style="width:200px;">
<h4><?php the_title(); ?></h4>
<?php the_content(); ?>
</div>
<?php endforeach; ?>
</div>
<script>
$(function() {
$("#accordion").tabs("#accordion div", {
tabs: \'img\',
effect: \'horizontal\'
});
});
</script>
<?php
}
add_action(\'nktframework_abovecontent\', \'retreats_accordion\', 10);
我尝试将此添加到函数中,但似乎不起作用。
if( is_page(107) )
return;