0

working on a scholar journal in which publisher add issues to the "issue" taxonomy assigned with articles. i need to display outside the loop a list of posts assigned only with the last issue (recently added). any help please?

update: i found a code to get the last term from a taxonomy:

$issue = get_terms('issue','orderby=none&order=DESC&number=1');
$current_issue = $issue[0]->slug;

But i couldn't find a way to use it to display a list of posts assigned only with that last term. any suggestions please?

2
  • The code above is not very reliable, but then again, if you need a reliable system, you have to write your own as this is not an added feature by default. Anyways, use WP_Query with a tax_query to query posts from the returned term – Pieter Goosen Jul 29 '15 at 13:18
  • thanks Mr. @PieterGoosen .. but i have another question on the same issue here (wordpress.stackexchange.com/questions/196181/…) – nisr Jul 31 '15 at 10:46
0

If you change the paramter "number" to 2 in the line :

$terms = get_terms( 'issue', 'orderby=id&order=DESC&number=1' );

How to get the term before the last from a custom taxonomy?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.