Get a random image to show the same on two image sections
if (have_posts()) : while (have_posts()) : the_post(); if($img_position == 'boxgrid'){ $thumb = get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); $pattern= "/(?<=src=['|\"])[^'|\"]*?(?=['|\"])/i"; preg_match($pattern, $thumb, $thePath); $random_number = mt_rand(1, 8); if(!isset($thePath[0])){ $thePath[0] = get_template_directory_uri().'/images/slideshow/noftrdimg-'.$random_number.'.jpg'; } $tmp .= '<div class="boxgrid captionfull" style="background: transparent url('.$thePath[0].') repeat scroll 0 0; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous; " title="'. get_the_title().'">'; $tmp .= '<div class="cover boxcaption">'; $tmp .= '<h3 style="padding-left:8px;"><a href="'. get_permalink().'" title="'. get_the_title().'">'. get_the_title().'</a></h3>'; $tmp .= '<p>'.substr(get_the_excerpt(), 0, 100).'</p>'; $tmp .= '</div>'; $tmp .= '</div>';
while (have_posts()) : the_post(); $url = get_permalink(); $theme_fields = get_post_custom_values('my_url'); if(isset($theme_fields[0])){ $url = $theme_fields[0]; } $tmp .='<div id="fragment-'.$id.'-'.$i.'" class="ui-tabs-panel">'. chr(13); $random_number = mt_rand(1, 8); if($width != '' || $height != ''){ if (get_the_post_thumbnail( $post->ID, array($width,$height),"" ) == '') { $ftrdimg = '<img src="'.get_template_directory_uri().'/images/slideshow/noftrdimg-'.$random_number.'.jpg" />'; } else { $ftrdimg = get_the_post_thumbnail( $post->ID, array($width,$height),"class={$reflect}" ); } } else { if (get_the_post_thumbnail( $post->ID, array(756,250),"" ) == '') { $ftrdimg = '<img src="'.get_template_directory_uri().'/images/slideshow/noftrdimg.jpg"/>'; } else { $ftrdimg = get_the_post_thumbnail( $post->ID, array(756,250),"class={$reflect}" ); } } $tmp .=' <a class="reflect" href="'.$url.'">'.$ftrdimg.'</a>'. chr(13);
Thanks!
Recurring Proven SEO Business Model Rent Out Your (Local) Sites and YT vids
Give you AD Funnel Super Power!
ADConnect.io - Lower CPC. Sky-Rocket Conversions!!