Last active
December 17, 2015 12:48
-
-
Save mkdizajn/5612020 to your computer and use it in GitHub Desktop.
wordpress function to get sinular <-> singular link between page and tax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// mk function to get singular <-> singular link. link between custom tax in pages == to pages order (parent - child) | |
// $a = post_type(string); | |
// $b = post_parent(int); | |
// $c = tax(string); | |
// $d = post_id(int); | |
function mk_get_tax_to_page_link( $a, $b, $c, $d ){ | |
$query = new WP_Query( array('post_type' => $a, 'post_parent' => $b, $c => get_the_term_list( $d, $c ))); | |
if ($query->have_posts()) { | |
$query->the_post(); | |
return the_permalink(); | |
} | |
wp_reset_query(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment