Someway to just echo the img tags?
-
Hello,
First off; love the plugin, its so easy ?? !!I was wondering if its possible if there is a way to echo just the img tags inside a template file?
Background:
In my theme there is a slider function already built in, which uses the core gallery function. Like this:<ul class="slides"> <?php $post_content = get_the_content(); preg_match('/\[gallery.*ids=.(.*).\]/', $post_content, $ids); $array_id = explode(",", $ids[1]); $content = str_replace($ids[0], "", $post_content); $filtered_content = apply_filters( 'the_content', $content); foreach($array_id as $img_id){ ?> <li><?php echo wp_get_attachment_image( $img_id, 'full' ); ?></li> <?php } ?> </ul>
But for a lot of reasons I dont want to use the built in theme slider. So im thinking of using the Easy Image Gallery Plugin instead.
I have tried this:
<ul class="slides"> <?php $post_content = get_the_content(); preg_match('/\[gallery.*ids=.(.*).\]/', $post_content, $ids); $array_id = explode(",", $ids[1]); $content = str_replace($ids[0], "", $post_content); $filtered_content = apply_filters( 'the_content', $content); foreach($array_id as $img_id){ ?> <li><?php if( function_exists( 'easy_image_gallery' ) ) { echo easy_image_gallery(); } ?></li> <?php } ?> </ul>
And it works kind of, but its echoing the whole Easy Image Gallery code, with ul and li and everything. So is it possible to just echo the img tags somehow?
Thanks in advance!
Kind regards,
Richard
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Someway to just echo the img tags?’ is closed to new replies.