Get the category name with the link
-
Hi there guys, I am using Flexible Posts Widget, but i can not find related information on their support page. If anyone can help me. Forgive my ignorance but i am trying to add
get_the_category
to this piece of code, and i have no idea what do i miss here./ Block direct requests if ( !defined('ABSPATH') ) die('-1'); echo $before_widget; if ( !empty($title) ) echo $before_title . $title . $after_title; if( $flexible_posts->have_posts() ): ?> <ul class="featured-posts row list-inline"> <?php while( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); global $post; ?> <li id="post-<?php the_ID(); ?>" <?php post_class('col-md-4'); ?>> <a href="<?php echo the_permalink(); ?>"> <?php if( $thumbnail == true ) { // If the post has a feature image, show it if( has_post_thumbnail() ) { the_post_thumbnail( $thumbsize ); // Else if the post has a mime type that starts with "image/" then show the image directly. } elseif( 'image/' == substr( $post->post_mime_type, 0, 6 ) ) { echo wp_get_attachment_image( $post->ID, $thumbsize ); } } ?> <div class="title-block"><h4 class="title-for-widget"><?php the_title(); ?></h4></div> </a> </li> <?php endwhile; ?> </ul><!-- .dpe-flexible-posts --> <?php else: // We have no posts ?> <div class="dpe-flexible-posts no-posts"> <p><?php _e( 'No post found', 'flexible-posts-widget' ); ?></p> </div> <?php endif; // End have_posts() echo $after_widget;
Thank you in advance
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Get the category name with the link’ is closed to new replies.