Answers for "show post category name wordpress"

PHP
0

display category name wordpress

<?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
	echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
}
?>
Posted by: Guest on December-18-2020
0

Get wordpress posts by category name..!

<?php query_posts('category_name=CATEGORYNAME&showposts=5');

while (have_posts()) : the_post(); ?>

the_title();   // To display the title of all posts that have category name selected 

the_content();   // To display the content of all posts that have category name selected 


<?php endwhile; ?>
Posted by: Guest on May-13-2021

Code answers related to "show post category name wordpress"

Browse Popular Code Answers by Language