• Resolved hambos22

    (@hambos22)


    I have that site : https://ougk.gr and i want on the navigation to have a link which points to the latest post of a specific category (full post with comments etc). How can i achieve that? thank you

Viewing 6 replies - 16 through 21 (of 21 total)
  • Thread Starter hambos22

    (@hambos22)

    oh wait! i forgot to make the other exclude=THE,IDs,OF,THE,PAGES,YOU,WANT,TO,EXCLUDE,COMMA,DELIMITED')

    Thread Starter hambos22

    (@hambos22)

    i had also submenus.. how can i add them on your code?

    <nav>
    	<ul id="main-nav" class="main-nav">
    	<?php
    	wp_list_pages('title_li=&include=THE,IDs,OF,THE,PAGES,YOU,WANT,TO,INCLUDE,COMMA,DELIMITED');
    	query_posts('cat=23&posts_per_page=1');
    	if(have_posts());
    	while(have_posts()) :
    	the_post();
    	?>
    		<li>
    			<a href="<?php echo get_permalink(); ?>">LATEST POST</a>
    		</li>
    	<?php
    	endwhile;
    	wp_reset_query();
    	?>
    	</ul>
    </nav>

    Try that. Obviously change where it says ‘THE,IDs,OF,THE,PAGES,YOU,WANT,TO,INCLUDE,COMMA,DELIMITED’ to the IDs of the pages you want to include.

    The above should also support sub-menus.

    Thread Starter hambos22

    (@hambos22)

    and how can i add the submenus? sorry if i’m too strenuous

    If you make pages children of the pages that are included in the nav, they should automatically be added as sub-menus.

    Thread Starter hambos22

    (@hambos22)

    Thank you so much! it worked! i wanted that for very long time but i couldn’t find anything!

    Thank you again! ??

Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Get latest post link on wordpress’ is closed to new replies.