Skip to content

Instantly share code, notes, and snippets.

@Falcornus
Falcornus / php
Created July 15, 2016 17:24
the_post_thumbnail() without size
add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10, 3 );
function remove_thumbnail_dimensions( $html, $post_id, $post_image_id ) {
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
@Falcornus
Falcornus / php
Last active July 15, 2016 15:26
Wordpress. Output articles
<?php if (have_posts() ): query_posts('p=12'); // article ID
while (have_posts() ): the_post(); ?>
<?php the_title(); ?> <!--Title-->
<?php the_content(); ?> <!--Content-->
<?php the_post_thumbnail(array(500,500)); ?> <!--Image-->
<?php endwhile; endif; wp_reset_query(); ?>