azezer
Forum Replies Created
-
Forum: Everything else WordPress
In reply to: Custom field, multiple valuesI finally saw the error, i forgot a = after src at the image.
The code works =) sweet.
Now to implement the Timtumb into this to, but thats another story.
Thanks for help stvwlf.
Tread solved
//Azezer
Forum: Everything else WordPress
In reply to: Custom field, multiple valuesNow i continued a bit and got this far:
<?php $products = get_post_meta($post->ID, "product", false); if ($products[0]=="") { ?> <!-- If there are no custom fields, show nothing --> <?php } else { ?> <div class="produktbeskrivning"> <h3>Products</h3> <?php foreach($products as $product) { $temp = explode("&", "$product"); $descrip = $temp[0]; $price = $temp[1]; $img = $temp[2]; echo '<div class="grid">'.$descrip.' '.$price.' <img src"'.$img.'" /></div>'; } ?> </div> <?php } ?>But i cant get the image to show.
I print this in custom field product:
Product&299:-&http://xxxxxx.com/wp-content/uploads/image.jpg
Do i miss something so that the server gets that it is a image to fetch?
Azezer
Forum: Everything else WordPress
In reply to: Custom field, multiple valuesI think i can use something like this:
"<img src='" . $img . "' />"to implemate in this:
<?php $products = get_post_meta($post->ID, "product", false); if ($products[0]=="") { ?> <!-- If there are no custom fields, show nothing --> <?php } else { ?> <div class="produktbeskrivning"> <h3>Products</h3> <?php foreach($products as $product) { $temp = explode("&", "$product"); $descrip = $temp[0]; $price = $temp[1]; $img = $temp[2]; echo '<div class="grid">'.$descrip.' '.$price.'</div>'; } ?> </div> <?php } ?>Ive tried to put in in after $price, but it gave me error ” blank page “.
search continues
Forum: Everything else WordPress
In reply to: Custom field, multiple valuesThanks stvwlf.
works like a charm, found som minor errors in the code like, { instead of [ at the temp variable.
foreach($products as $product // why do we say, $products as $product ?
Is it so that $ products is a multiple value and we want to declare that we can use it as $product several times?Now i want to implement a <img> above each Product.
Will try to do this when i get home from work, maybe i can manage that myself.
Azezer
Forum: Everything else WordPress
In reply to: Custom field, multiple valuesAnybody who has a tip where i can read about this and more?
Azezer
Forum: Everything else WordPress
In reply to: Custom field, multiple valuesThank u!
Now i got a output of that seccond_value.
But still only if i have a true statement of that value.
I guess that a need to do that foreach statement for the seccond value as well, but how do i combine theese two, or three … for that matter.
<?php foreach($description as $description)// how to add $seccond_value here?Another question that popped up is if i can combine two $values if i always wants the to be together.
Like description and price.
$description $priceI mean to save code space and only declare thoose two one time, nd then have 1 combined vale like $product ?.