Skip to content

Instantly share code, notes, and snippets.

@karloskar
Last active December 23, 2017 11:15
Show Gist options
  • Save karloskar/fcea0cea19bddb93c8b4 to your computer and use it in GitHub Desktop.
Save karloskar/fcea0cea19bddb93c8b4 to your computer and use it in GitHub Desktop.
Exempel på visning av annonser baserat på en viss tagg.
<?php
$jobs = get_posts(array(
'post_type' => 'pnty_job',
'numberposts' => -1,
'tax_query' => array(array(
'taxonomy' => 'pnty_job_tag',
'field' => 'slug',
'terms' => 'exempeltagg'
))
));
?>
<?php if (count($jobs) > 0):?>
<ul class="exempel">
<?php foreach($jobs as $job):?>
<li>
<a
href="<?php echo get_permalink($job->ID);?>"
title="Permalänk till <?php echo $job->post_title;?>"
>
<?php echo $job->post_title;?>
</a>
</li>
<?php endforeach;?>
</ul>
<?php else:?>
<p>Det finns inga publicerade annonser just nu.</p>
<?php endif;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment