Skip to content

Instantly share code, notes, and snippets.

@jackabox
Created November 3, 2016 14:06
Show Gist options
  • Select an option

  • Save jackabox/3467aa00dfceae39583eef5581397aca to your computer and use it in GitHub Desktop.

Select an option

Save jackabox/3467aa00dfceae39583eef5581397aca to your computer and use it in GitHub Desktop.
example custom query
<?php
$query = new WP_Query([
'post_type' => ['posts', 'adso_instagram', 'adso_facebook', 'adso_twitter', 'adso_youtube'],
'post_status' => 'publish',
'posts_per_page' => 30,
'orderby' => 'date',
'order' => 'DESC',
'cache_results' => TRUE,
]);
if ( $query->have_posts() ) : ?>
<ol class="adso adtrak-social-plugin" data-columns>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php
$type = $adtrakSocial->return_post_type(get_post_type());
$timeago = $adtrakSocial->time_ago(get_post_time());
$meta = get_post_meta(get_the_ID(), 'adso_meta', true);
?>
<li class="adso-post adso-post-<?php echo $type; ?>">
<?php if(!empty($meta['image'])) { ?>
<p class="adso-post-image">
<img src="<?php echo $meta['image'] ?>" alt="<?php echo get_the_title(); ?>"/>
</p>
<?php } ?>
<?php if($type == 'blog') { ?>
<p class="adso-post-content"><?php the_excerpt(); ?></p>
<?php } else { ?>
<p class="adso-post-content"><?php echo get_the_content(); ?></p>
<?php } ?>
<?php if($type == 'blog') { ?>
<p class="adso-button adso-read-more"><a href="<?php the_permalink(); ?>" title="Link to <?php the_title(); ?>">Read More</a></p>
<?php } ?>
<span class="adso-post-date"><?php echo $timeago ?> ago.</span>
<span class="adso-post-type adso-post-type-<?php echo $type; ?>"><a href="<?php echo get_post_meta(get_the_ID(), 'adso_link', true); ?>"><?php echo ucwords($type) ?></a></span>
</li>
<?php endwhile; ?>
</ol>
<?php endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment