Skip to content

Instantly share code, notes, and snippets.

@jesseschmidt
jesseschmidt / wp-get-all-terms.php
Created August 24, 2020 19:15
WordPress get all terms from categories and tags
$term_query = new WP_Term_Query(
array(
'taxonomy' => array('category','post_tag'),
'order' => 'ASC',
'orderby' => 'name'
)
);
if ( ! empty( $term_query->terms ) ) {
foreach ( $term_query->terms as $term ) {

Keybase proof

I hereby claim:

  • I am jesseschmidt on github.
  • I am jesseschmidt (https://keybase.io/jesseschmidt) on keybase.
  • I have a public key ASDSgMCF58WnZ9LGuqVmjpVfJUwgeehUHYjYjUo-fwbGnAo

To claim this, I am signing this object:

@jesseschmidt
jesseschmidt / reddit-WP-1fes98.php
Created May 31, 2013 23:47
Show different thumbnail for posts that are not tagged with tradeshow.
<?php
$recent = new WP_Query("cat=11&showposts=2"); while($recent->have_posts()) : $recent->the_post();
if ( has_tag( 'tradeshow' ) ) {
echo '<a href="http://demo.com/your_image.jpg">Link Title</a>';
} else {
echo '<a href="' . the_permalink() . '">' . get_the_post_thumbnail() . '</a>';
}
endwhile;
?>