The shortcode i use on pages outputs a column of latest featured images of posts, and the post tile link

example

IMG.jpg — postlink

img2.jpg — postlink2

img3.jpg — postlink3

im trying to edit the custom css to change the fonts, and font size of the post links this shortcode produces but have failed.

here is the code for the shortcode…

`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 .= ”;
while ( $the_query->have_posts() ) {
$the_query->the_post();
if ( has_post_thumbnail() ) {
$string .= ‘

  • ‘;
    $string .= ” . get_the_post_thumbnail($post_id, array( 500, 500) ) . get_the_title() .’
  • ‘;
    } else {
    // if no featured image is found
    $string .= ‘

  • ‘ . get_the_title() .’
  • ‘;
    }
    }
    } else {
    // no posts found
    }
    $string .= ”;

    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’);
    `


    my css looks like this which does make the link text bold, however when i try to ad font size, or font type… i get nothing

    `ul.postsbycategory {
    Font-weight: bold;
    }

    `

    Thanks to anyone who can help here. lol

    Read more here: trouble editing font size for a short code


    Solution:

    If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


    Wordpress related questions and answers: