Category page with thumb is ok but can’t do the same with tags

What am i missing? ‘tag’ may be a valid argument for get_posts() via WP_Query, but requires the tag slug in that case. Try using ‘tag_id’ instead. get_posts() apparently enables ‘category’, but expects the the ID, even though in WP_Query the same argument is ‘cat’ (vs. ‘category_name’, et al). A little confusing, perhaps, altogether. I know … Read more

Make image full width

Use the following CSS to target only the banner image on single posts: body.sinlge .size-banner-image { width:100%; } This will only work if your <div class=”container”> element is not restricted in its width, else the banner will only stretch to the container width.

Add extra fields to the post’s featured image

In your case, you need to add custom fields to the metabox. The full reference code of the filter is here: ‘admin_post_thumbnail_html’ – https://developer.wordpress.org/reference/hooks/admin_post_thumbnail_html/. Let’s add an image title: <?php add_filter(‘admin_post_thumbnail_html’, ‘custom_featured_image_field’, 10, 2); function custom_featured_image_field($content, $post_id) { $custom_name = ‘custom_featured_image_title’; $custom_value = esc_attr(get_post_meta($post_id, $custom_name, true)); $output = sprintf( ‘<br><input type=“text” id=”%1$s” name=”%1$s” value=”%2$s”>’, $custom_name, … Read more

get_post_thumbnail does not display thumbnail

Make sure to use echo with get_the_post_thumbnail(): echo get_the_post_thumbnail(64 , ‘post-thumbnail’, array( ‘class’ => ‘img-format-big’ ) ); In WordPress, a rule of thumb (no pun intended) is to use echo with functions prefixed with get_. Functions prefixed with the_ on the other hand, display their output immediately (e.g. the_post_thumbnail() ).

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)