Template visualizzazione pubblicazioni

This commit is contained in:
marco
2018-08-08 17:53:24 +02:00
parent fe4493426d
commit e22db6a35d
+40
View File
@@ -0,0 +1,40 @@
<?php
/* template name: Posts by Category! */
get_header(); ?>
<div id="container" style="font-style: italic; padding-left:10px;">
<div id="content" role="main">
<?php
// get all the categories from the database
$cats = get_categories();
$catsrev = array_reverse($cats);
// loop through the categries
foreach ($catsrev as $cat) {
// setup the cateogory ID
$cat_id= $cat->term_id;
// Make a header for the cateogry
echo "<h2>".$cat->name."</h2>";
// create a custom wordpress query
query_posts("cat=$cat_id&posts_per_page=100");
// start the wordpress loop!
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php // create our link now that the post is setup ?>
<span><?php the_tags(" "); echo "(<i>".$cat->name."</i>)";?></span> -
<a href="<?php the_permalink();?>">
<?php the_title(); ?> -
<?php $key="rivista"; echo get_post_meta($post->ID, $key, true); ?> -
</a>
<a target="_blank" href="<?php $key="arxivdoi"; echo get_post_meta($post->ID, $key, true); ?>">Doi</a>
<?php // prova ?>
<?php echo '<hr/>'; ?>
<?php endwhile; endif; // done our wordpress loop. Will start again for each category ?>
<?php } // done the foreach statement ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_footer(); ?>