View Single Post
Old 07-08-2015, 12:39 PM  
lollipopx
Confirmed User
 
lollipopx's Avatar
 
Industry Role:
Join Date: Apr 2014
Posts: 171
Word Press template to page script question

Is it possble and exactly how would it be to add this on page rather than through theme template so it functions on page as well?

heres script in question as much as far as I can tell is needed from the template

<h2 class="post-title">Videos selected for you</h2>

<?php $args = array( 'numberposts' => 42, 'orderby' => 'rand', 'category__in' => array(782, 829) ); $rand_posts = get_posts( $args );

foreach( $rand_posts as $post ) : ?>

<div class="post" id="post-<?php the_ID(); ?>">

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(240,180), array('alt' => get_the_title(), 'title' => '')); ?></a>

<?php if ( get_post_meta($post->ID, 'duration', true) ) : ?><div class="duration"><?php echo get_post_meta($post->ID, 'duration', true) ?></div><?php endif; ?>

<div class="link"><a href="<?php the_permalink() ?>"><?php short_title('...', '34'); ?></a></div>



</div>

<?php endforeach; ?>

<div class="clear"></div>

<?php }

else { ?>

<h2>Sorry, no posts matched your criteria</h2>

<?php } ?>

</div>

whats needed and not needed to make this work on page.
__________________
Lollipopx.com
Twitter @lollipopx_1, Tumblr lollipop-x, ICQ 669068563, Skype lollipop_130 Tell me your from gfy or i might ignore you.
lollipopx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook