Viewing 12 replies - 1 through 12 (of 12 total)
  • wpismypuppet

    (@wordpressismypuppet)

    What’s the error?

    Thread Starter christopherburton

    (@christopherburton)

    Warning: preg_replace() [function.preg-replace]: Unknown modifier ‘c’ in C:\Users\Chris\Desktop\wamp\www\wordpress\wp-content\themes\murtaugh-HTML5-Reset-Wordpress-Theme-8aa6329\functions.php on line 164

    Line 164: $output = preg_replace('<code>class=&quot;(.*?)&quot;</code>', '', $output);

    wpismypuppet

    (@wordpressismypuppet)

    It’s the correct code, but an incorrect preg_replace. Use this… I tested and it works:

    //remove class from the_post_thumbnail
    function the_post_thumbnail_remove_class($output) {
    	$output = preg_replace('/class=".*?"/', '', $output);
    	return $output;
    }
    add_filter('post_thumbnail_html', 'the_post_thumbnail_remove_class');
    Thread Starter christopherburton

    (@christopherburton)

    Really appreciate that.

    wpismypuppet

    (@wordpressismypuppet)

    You are welcome…

    Thread Starter christopherburton

    (@christopherburton)

    For some reason it leaves off the trailing ‘/>’ of the img tag.

    Edit: My fault.

    wpismypuppet

    (@wordpressismypuppet)

    Mine is still there… make sure you check your source code, and not just through Firebug or something… my Firebug leaves it off, but my source code shows it.

    Thread Starter christopherburton

    (@christopherburton)

    Yeah, it’s all good. I didn’t see it at first but it’s there.

    Hello, I have the same issue except that I seem to know less about codes than both of you. I’m working with Gridportfolio theme. Could you tell me where to put the code posted above and other details i should know for the ‘post-thumbnails’ to be disabled?
    Thanks!

    Thread Starter christopherburton

    (@christopherburton)

    The code above goes into the functions.php file.

    Olá, tudo bem?
    Desculpa o encomodo, mas é que estou a procura de alguém pra me quebrar um galho.
    Seguinte, tenho esse blog https://www.valmirlima.com.br que estou programando, porém ele é meio diferente dos outros, porque mesmo se eu n?o inserir imagem no post, aparece esse thumbnail na página principal. Como a maioria dos posts no blog n?o tem imagem, fica estranho né. Daí quero saber se voces podem me dar essa for?a, porque já procurei nos códigos e nada.
    Eu quero que apare?a imagem na home apenas quando eu colocar imagem destacada, quando eu n?o colocar, é pra aparecer só o título e uma prévia do texto mesmo, como é na maioria dos blogs.
    Serei muito grato!

    @rabeloalexandre

    please post in English.

    and start a new topic.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Remove Post Thumbnail classes’ is closed to new replies.