Fig-caption textsize with image ID in CSS

Hello together,

I would like to define the text size of the caption for certain images on the image id and css.

Example: https://www.die-geniessermanufactur.de/der-shop/chilipasten/chilipaste-infernale/
Only the font under the pictures vegan, glutenfree etc. should have a defined font size. The font size of the other caption should remain.

    .wp-caption .wp-caption-text {
        font-size: 12px;
    }

How do I define the image ID via CSS? The image ID for glutenfrei.png is 10834.

Can you help me? Thank you so much and i hope, you can understand my bad english…

Greetings from Germany

Sabine

Hi Sabine,

You do not need to add ID to the image caption to do that. You only need to set more specific class to the caption. Try this:

.woocommerce-product-details__short-description figure figcaption {
    font-size: 12px;
}

You can put the code into customize > additional CSS

Regards,
Awan

Hi Awan,

thank you very much. It works!

Greetings from Germany

Sabine

1 Like

Hello Awan,

the CSS-Code works. But I see in the search result for example of spice chili paste (see link) programming codes. Can you switch this off?

Example:

Greetings, Sabine

Hi,

The link is broken

Hi, now the link works. Sorry!

Looks like the is the shortcode not filtered in the excerpt function.
To try fix it, firstly you need to create a child theme and then add this code in functions.php file in your child theme:

add_filter( 'the_excerpt', 'shortcode_unautop');
add_filter( 'the_excerpt', 'do_shortcode');
add_filter( 'get_the_excerpt', 'do_shortcode', 5 );

Hello Awan,

it works! Thank you very much.

Greetings from a very hot and dry Germany

Sabine

1 Like