airdrawndagger
Member
Posted 2 years ago #
At the WordPress site for one of the magazines my company publishes I have a menu alternative for "latest issue". This is now just a page in wordpress, that the editor updates manually with each issue. I'd like for the new issue to be published to this page via a post in a certain category. What's an easy way to accomplish this? Thanks for any help!
airdrawndagger
Member
Posted 2 years ago #
Here's the page in question: http://www.framsidan.net/senaste-numret/
To somehow have that static url display the latest post from a category...
if you have not already, read the information of the codex:
http://codex.wordpress.org/Pages
http://codex.wordpress.org/Pages#Page_Templates
make a page template, by following the instructions, (as a start, you could use the code from page.php or single.php, and then customize it to your needs)
and then add a query for your certain category before of the loop.
http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters
and then in admin/ pages/ edit/ edit the page ( used to show the "latest issue") and the choose your new page template under 'attributes' 'template' from the drop-down list.
airdrawndagger
Member
Posted 2 years ago #
Thank you! Very helpful. I'll try this.
airdrawndagger
Member
Posted 2 years ago #
I think I get it, but unfortunately I suck at PHP. Maybe you could help out with what I need to change here to make this code display the latest post from a category. This is the code from single.php in arras-theme which I use:
<div id="content" class="section">
<?php arras_above_content() ?>
<?php
if ( arras_get_option('single_meta_pos') == 'bottom' ) add_filter('arras_postfooter', 'arras_postmeta');
else add_filter('arras_postheader', 'arras_postmeta');
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php arras_above_post() ?>
<div id="post-<?php the_ID() ?>" <?php arras_single_post_class() ?>>
<?php arras_postheader() ?>
<div class="entry-content">
<?php the_content( __('<p>Read the rest of this entry »</p>', 'arras') ); ?>
<?php wp_link_pages(array('before' => __('<p><strong>Pages:</strong> ', 'arras'),
'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<!-- <?php trackback_rdf() ?> -->
<?php arras_postfooter() ?>
</div>
<?php arras_below_post() ?>
<a name="comments"></a>
<?php comments_template('', true); ?>
<?php arras_below_comments() ?>
<?php endwhile; else: ?>
<?php arras_post_notfound() ?>
<?php endif; ?>
<?php arras_below_content() ?>
</div><!-- #content -->
airdrawndagger
Member
Posted 2 years ago #
So far I added:
<?php query_posts('category_name=tidningen&posts_per_page=1');
And it does what I want, however, it doesn't display the comments below the post!