I want my wordpress page to show recent posts, with just one category. I'm new to PHP and wordpress, so please bear with me.
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo esc_html( $categories[0]->name );
}
When I past this code into my functions.php, the site crashes.
You can see the site here: http://2016.sv.emil2518.mguro.sde.dk/skatersmag/