CSS not responding well with Shortcode
-
mixed in with some CSS, im getting just about everything I want from this short code.
/* ================================= Displays posts from specified category on homepage ================================= */ add_filter( 'category_description', 'do_shortcode'); function wpb_postsbycategory() { // the query $the_query = new WP_Query( array( 'category_name' => 'crazy-humorous-pictures, strange-news-stories', 'posts_per_page' => 10 ) ); // The Loop if ( $the_query->have_posts() ) { $string .= '<ul class="postsbycategory widget_recent_entries">'; while ( $the_query->have_posts() ) { $the_query->the_post(); if ( has_post_thumbnail() ) { $string .= '<li>'; $string .= '<a href="' . get_the_permalink() .'" rel="bookmark">' . get_the_post_thumbnail($post_id, array( 500, 500) ) . get_the_title() . '</a></li>'; } else { // if no featured image is found $string .= '<li><a href="' . get_the_permalink() .'" rel="bookmark">' . get_the_title() . get_the_content() .'</a></li>'; } } } else { // no posts found } $string .= '</ul>'; return $string; /* Restore original Post Data */ wp_reset_postdata(); } // Add a shortcode add_shortcode('categoryposts', 'wpb_postsbycategory'); // Enable shortcodes in text widgets add_filter('widget_text', 'do_shortcode');However when using custom CSS, it is not to easy getting the “post title” to float above the featured image thumbnails. by float above I mean…be displayed above the thumbnail
the post title link is very stubborn, and wont budge from being on the left side of the thumbnails. I want the title above the post thumbnails.
also note. it seems the post title is somehow connected with the post thumbnail. im sensing this is something to do with this code.
anyone got some answers to this?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘CSS not responding well with Shortcode’ is closed to new replies.