php - Add element to if else statement. Wordpress -


i have if else statement gives me <img src=""..../> element result. problem want statement give me result <li><img src=""..../></li>

i wrap if stament around <li> element loose purpose of im trying do. there way can add <li> elements inside if statement ?

function

<?php if(class_exists('multipostthumbnails')     && multipostthumbnails::has_post_thumbnail('post', 'secondary-image')) {     multipostthumbnails::the_post_thumbnail('post', 'secondary-image', null, 'post-secondary-image-thumbnail');         }else {   } ?> 

result

<img src="..."/> 

desired result

<li> <img src="..."/></li>

the source code is

if (class_exists('multipostthumbnails')) { new multipostthumbnails(array( 'label' => 'secondary image', 'id' => 'secondary-image', 'post_type' => 'post'  ) )  ;new multipostthumbnails(array( 'label' => 'third image', 'id' => 'third-image', 'post_type' => 'post'  ) );   } 

instead wrapping <li> around if statement, can use get_the_post_thumbnail() instead of the_post_thumbnail(). function return img tag string not echo it.

you can string manipulation/add tags , echo whenever want.

source: http://voceconnect.github.io/multi-post-thumbnails/


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -