WP 3.3 & Magic Tags within PHP help
I read in another thread that magic tags can no longer be used in PHP and this killed my site.
If you could do me a favour show me how to convert these mixed tags into pure PHP that would help a lot.
Thank you!
<?php if (({@active}=="1" ) && ({@product_types.id}=="5" ) ): ?>
<?php echo do_shortcode('{@addtocart}'); ?>
3 Answers
Assuming you've defined your pods variable as $pods, you'll be able to replace these like this:
<?php
$active = $pods->get_field('active');
$prod_id = $pods->get_field('product_types.id);
if (($active == "1" ) && ($prod_id == "5")): ?>
<?php echo do_shortcode($pods->get_field('addtocart') ); ?>
I tried that short code thing before and I didn't work but my syntax must have been off. Thank you very much! It works now! huzzah!
The active/prod types thing doesn't seem to make a difference. I thought perhaps it was the "check if active" php/magic tag because the homepage slider wasn't showing images until I updated that piece, but this still isn't working. Maybe the showimages helper doesn't work with the current update? I'll keep trying. THANK YOU!!!
Ok I fixed it. I had to pull out {@photo, showimages} and replace it with
<?php foreach ($this->get_field('photo') as $photo) { $img_thumb = wp_get_attachment_image_src($photo['ID'], 'thumbnail'); echo "<img src=\"{$img_thumb[0]}\" />"; }?>
edited Dec 18 '11 at 2:46


