Created
August 18, 2012 06:44
-
-
Save senlin/3384967 to your computer and use it in GitHub Desktop.
sample code to implement ContentFlow.js in WordPress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// the following will be part of your loop. | |
?> | |
<div class="ContentFlow"> | |
<div class="flow"> | |
<?php | |
$asliders = query_posts('post_type=artist&posts_per_page=-1'); | |
if ($asliders) { | |
foreach ($asliders as $aslider) { | |
// my original code included a checkbox custom metabox "_artist_slider", the code below calls these metadat and checks whether this box has been ticked ("on"). If your site doesn't use any metaboxes to condtionally show the post in the slider, then you need to delete the "if ($meta == 'on')" condition. | |
$meta = get_post_meta($aslider->ID, '_artist_slider', true); | |
if ($meta == 'on') { | |
echo '<div class="item" href="' . get_permalink($aslider->ID) . '">'; | |
echo get_the_post_thumbnail ($aslider->ID, array ( 200,100 ), array( 'class' => 'content' ) ); | |
echo '<div class="caption">'; | |
echo get_the_title($aslider->ID); | |
echo '</div>'; | |
echo '</div>'; | |
} | |
} | |
} | |
?> | |
</div><!--.flow--> | |
<div class="scrollbar"><div class="slider"><div class="position"></div></div></div> | |
</div><!--.ContentFlow--> | |
<?php | |
// the following will have to be added to your header; in my case I used the white addon, so I added load=white | |
?> | |
<script language="JavaScript" type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/contentflow.js" load="white"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment