Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134342

gammis on "getting category-values from meta-keys?"

$
0
0

So, this is what I want to do:

I have one post-type called "albums", it has a certain template that allows those posts to list all "song"-posts that suppose to connect with the "album-posts". but how?

this is the code sofar:

<?php  $args = array(
   'cat'      => 14,
   'meta_key' => 'order_in_album',
   'orderby' => 'meta_value_num',
   'order' => 'ASC'
 ); ?>
<?php $my_query = new WP_Query($args); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php $do_not_duplicate = $post->ID; ?>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br>

<?php endwhile; ?>

So, you se that the cat is static = 14. I need it to be flexible depending on what album-post I'm opening. Can I, somehow, fetch the value of the category by making a simple meta_key for the album-posts?

...and then HOW would that code look like?


Viewing all articles
Browse latest Browse all 134342

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>