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>';
}
?><?php
$user_info = get_userdata(1);
echo 'Username: ' . $user_info->user_login . "\n";
echo 'User roles: ' . implode(', ', $user_info->roles) . "\n";
echo 'User ID: ' . $user_info->ID . "\n";
?><?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo esc_html( $categories[0]->name ); // Show first item of category
}
?>
Also in PHP:
- composer install laravel 7 not installing
- create symfony project
- does queen elizabeth control canada
- 1,458.00 to save as float php
- confirm password validation in laravel
- error log display
- filteredduplicata php
- check if a string is in another string python php
- $db new PDO php
- encryption and decryption in codeigniter
- "data:text/vcard;
- $mpdf
- add customer attributes via upgrad data in magento 2
- check string in php
- Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/composer/composer.phar/s
- capital letter php
- add google analytics to website laravel
- date(Y m d) php
- artisan cache command in laravel
- current date into time
- $name = $name; "Robert" echo;
- currentDateTime php
- date format php sql
- $_server 'remote_addr' not working properly