Button to latest post in a category

Hi, how can i link a button to the latest post in a category , i want the button on index permanently but i want it to take u to the last post from that category, is there a special link or a plugin so i can do this? sorry for my bad english. and ty.

Not aware of any premade plugin that can do this.

Take a look at WP_Query though, specifically the category parameters: https://developer.wordpress.org/reference/classes/wp_query/#category-parameters

Can’t think of a better way right now, although I’d try something like this:

<?php
$latest_post_in_category_args = array(
	'category_name' => 'category-slug-here',
);

$latest_post_in_category_query = new WP_Query( $latest_post_in_category_args );
 
// The Loop
if ( $latest_post_in_category_query->have_posts() ) :
    while ( $latest_post_in_category_query->have_posts() ) :
        $latest_post_in_category_query->the_post();
		?>
			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
		<?php
    endwhile;
endif;

/* Restore original Post Data */
wp_reset_postdata();
?>

Dynamically grabbing the category will be a bit more complicated. See here for more info if that’s what you want to do: https://wordpress.stackexchange.com/questions/18652/get-category-id-inside-category-template

I’m not exactly sure where you want these links to display, so the example above requires hardcoding the category slug.

You could also set up a category template for each one following the template hierarchy: https://codex.wordpress.org/Category_Templates#What_Template_File_is_Used.3F

Not tested, no warranty, no support, use at your own risk.

This is just to get you started. Hope it helps in some way.