DerekJR123 on "[Plugin: Strong Testimonials] Adding custom class to image"

ساخت وبلاگ

DerekJR123
Member
Posted 14 hours ago #

Hello,

I am wondering if there is any way to add a custom class to the thumbnail image? (wpmtst_the_thumbnail()).

I tried putting it inside the brackets just as a shot in the dark but it didn't work.

Also, just as a separate question, is there a way to break up the full name and the company name for purposes of template styling? Right now I'm just showing them as <h2>? wpmtst_the_client ?</h2>. I'd like to be able to use a smaller font size for the company name. Just curious if its possible.

Thanks,

Derek

https://wordpress.org/plugins/strong-testimonials/

DerekJR123
Member
Posted 14 hours ago #

*note*

Please disregard my second question. I figured out a way to solve the problem.

Thanks,
Derek

Hi Derek,

You can always reach it in CSS with:

.testimonial-image img {}

Or use the image attributes filter:

function testimonial_image_attr( $attr, $attachment, $size ) { if ( 'wpm-testimonial' == get_post_type( get_post( $attachment->post_parent ) ) ) { // a space before the name $attr['class'] .= ' my-custom-class'; } retu $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'testimonial_image_attr', 10, 3 );

DerekJR123
Member
Posted 1 minute ago #

Ah excellent. Thank you very much.

Another question... sorry for the barrage.

Every time I update the plugin, it ends up deleting my custom templates. Where should I be putting them? I tried putting them in my theme as a child element but it doesn't seem to work. Any thoughts?

Thanks,

Derek

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 206 تاريخ : جمعه 24 ارديبهشت 1395 ساعت: 0:52