Rule for showing this box is : If img = 600px , after H2 show box ; else do nothing
And code goes like this:
public function sadrzaj_dodaj_widget($content) {
if(is_single()) {
global $post;
if(has_post_thumbnail($post->ID)) {
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
list($slika_sirina, $slika_visina, $slika_tip, $slika_attr) = getimagesize( get_attached_file( $post_thumbnail_id ) );
if($slika_sirina == 600) {
//Filtriranje samo ako je post
$html .= preg_replace('/<\/h{1}2>/', '</h2>'.$this->html_widgeta(), $content, 1);
return $html;
}
}
}
return $content;
}
No comments:
Post a Comment