-1

I have a list of clients with his telephones numbers and i call this custom type. I want change this whole numbers with images and not html numbers.

My actual code. Show in html 555 666 777 / 333 444 555

<?php global $wp_query; $postid = $wp_query->post->ID; $meta1 = get_post_meta($postid, 'telefono_2', true); ?>
<?php global $wp_query; $postid = $wp_query->post->ID; $meta = get_post_meta($postid, 'telefono_3', true);
$meta1 = preg_replace('/[^0-9]*/','', $meta1);
$meta1 =
substr($meta1, 0, 3) . ' ' . substr($meta1, 3, 3) . ' ' . substr($meta1, 6, 3);
echo $meta1;
if($meta != 0) {
$meta = preg_replace('/[^0-9]*/','', $meta);
$meta2 =
substr($meta, 0, 3) . ' ' . substr($meta, 3, 3) . ' ' . substr($meta, 6, 3);
echo " <span style='color:#EEEEEE !important;'>|</span> ".$meta2;
} ?>

I wish last three numbers for example was images 7.jpg but dynamic. It's possible? If not possible only last three, all the numbers is valid too.

Example final code output:

555 666 <img src="7.jpg" /><img src="7.jpg" /><img src="7.jpg" />
4

1 回答 1

1

假设$n1,$n2$n3是最后三个数字(您需要为我澄清代码以帮助适当调整变量,只需执行以下操作:

echo '<img src="'.$n1.'" />';
echo '<img src="'.$n2.'" />';
echo '<img src="'.$n3.'" />';

(免责声明:代码未经测试并且是示例代码-请不要复制和粘贴,而是将其用作一个想法。当然,除非您指的是 JavaScript 方面,在这种情况下它是完全不同的)

于 2013-10-27T10:56:16.390 回答