I have the following WordPress query:
$my_query = new WP_Query($args);
if ($my_query->have_posts()) {
echo '<div class="' . $tax_term->slug . '" style="display:none; background:url(' . $whatdoiputhere . ');">';
while ($my_query->have_posts()) : $my_query->the_post();
In the background URL, I need to include an image URL that is generated by the following code:
<?php if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(); ?>
How would I include this IF function inside the background URL?
I tried this but as you can guess it didn’t work:
background:url(' . if (function_exists('z_taxonomy_image_url')) echo z_taxonomy_image_url(); . ');
Would appreciate some help as to how I would do this.
1 Answer