• 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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter airdrawndagger

    (@airdrawndagger)

    Here’s the page in question: https://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:

    https://codex.www.ads-software.com/Pages
    https://codex.www.ads-software.com/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.

    https://codex.www.ads-software.com/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.

    Thread Starter airdrawndagger

    (@airdrawndagger)

    Thank you! Very helpful. I’ll try this.

    Thread Starter airdrawndagger

    (@airdrawndagger)

    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 &raquo;</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 -->
    Thread Starter airdrawndagger

    (@airdrawndagger)

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display latest post from a certain category on a “page”’ is closed to new replies.