Skip to content

Instantly share code, notes, and snippets.

@Asinox
Last active February 27, 2020 18:40
Show Gist options
  • Save Asinox/1054b1830be0d651cb2ff4646843183a to your computer and use it in GitHub Desktop.
Save Asinox/1054b1830be0d651cb2ff4646843183a to your computer and use it in GitHub Desktop.
WP_filter
<?php
query_posts("showposts=40&meta_key=Materia_1&orderby=title&order=DESC");
$coma;
if (have_posts()) : while (have_posts()) : the_post();
$do_not_duplicate = $post->ID;
$materias[] = get_post_meta(get_the_ID(), 'Materia_1', true);
//$found = explode("," , get_post_meta(get_the_ID(), 'Materias', true));
$coma = get_post_meta(get_the_ID(), 'Materias', true);
endwhile;
//$found = array_count_values($materias);
$materias = array_unique($materias);
echo $coma;
foreach($materias as $materia){
//echo $materia."<br/>";
echo "<h4><a href=\"http://bnphu.gob.do/disepedi/libros-por-materia/?autor=".$materia."\">".$materia."(".$coma.")</h4>";
}
?>
<?php else: ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment