Im using Artiss Currency Converter to convert some numbers on my website. Im trying to out put do_shortcode('[convert number=1 from="aud" to="jpy"]') in 2 pages. One is a template page in mythemefolder/newtemplate.php and the other is in mythemefolder/functions/single_product.php
do_shortcode('[convert number=1 from="aud" to="jpy"]') works Perfect in newtempalte.php but it doesn't seem to work in single_product.php.
Why is that? How can I fix it and does it matter where the php file is for do_shortcode to work?
This is the funciton in single_product.php
function cps_ajax_search($meta_boxes){
$posts = cps_search_posts();?>
<?php get_template_part("sidebar-left-common");?>
<?php require_once(TEMPLATEPATH."/functions/var/default-box-one.php"); ?>
<div class="detail-page-content hideOnSearch">
<!-- detail page content starts -->
<div class="searchBreadcrumbs"><!-- breadcrumbs starts -->
<?php '<a href="#" class="cpsBack">Home</a> »';?>
<?php cps_breadcrumbs(); ?>
</div> <!-- breadcrumbs ends -->
<div style="clear:both"></div>
<div class="sort-by-bar"> <!-- sort bar starts -->
<div class="searchSort"> <!-- search sort starts -->
<?php _e('Sort By:','language');?>
<?php cps_sort_by('miles') ?> -
<?php cps_sort_by('year') ?> -
<?php cps_sort_by('price') ?>
</div> <!-- search sort ends -->
</div> <!-- sort bar ends -->
<div style="clear:both"></div>
<?php wp_reset_postdata();?>
<?php
$displayed = array();
if(!empty($posts)): foreach($posts as $post):
if(in_array($post->ID,$displayed)):
continue;
else:
$displayed[] = $post->ID;
endif;
?>
<?php global $options;$fields;$options2;$options3;$symbols;
$fields = get_post_meta($post->ID, 'mod1', true);
$options2 = get_post_meta($post->ID, 'mod2', true);
$options3 = get_post_meta($post->ID, 'mod3', true);
$symbols = get_option('gorilla_symbols');
$options = get_option('gorilla_fields'); ?>
<?php $blogurl = get_bloginfo('template_url'); ?>
<?php $surl = get_bloginfo('url'); ?>
<div class="result-car"><!-- result car -->
<?php
$args = array(
'order' => 'ASC',
'orderby' => 'menu_order',
'post_type' => 'attachment',
'post_parent' => $post->ID,
'post_mime_type' => 'image',
'post_status' => null,
'numberposts' => 1,
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo '<a href='.$surl.'/'.$post->post_name.'>'.wp_get_attachment_image($attachment->ID, 'thumbnail_results').'<span class="'.$fields['statustag'].'"></span></a>';
}
} ?>
<div class="result-detail-wrapper"> <!-- result detail wrapper -->
<p><a href="<?php echo $post->post_name ?>" rel="bookmark" title="<?php echo $post->post_title ?>"><?php if ( $fields['year']){ echo $fields['year'];}else { echo ''; }?> <?php echo $post->post_title ?></a></p>
<p><strong><?php if (isset( $fields['miles'])){
##### New ##########
//number_format($fields['miles'],0,'.','.')
echo number_format($fields['miles'],0,'.',',').' '.$options['milestext'];
##### End ##########
}else { echo ''; };?></strong></p>
<p><?php if (isset( $fields['vehicletype'])){ echo $fields['vehicletype'].' | ';}else { echo ''; };?> <?php if (isset( $fields['transmission'])){ echo $fields['transmission'];}else { echo ''; };?><br/><?php if (isset( $options2['cylinders'])){ echo $options2['cylinders'].' '.$options['cylinderstext'].' | ';}else { echo ''; };?><?php if (isset( $fields['interior'])){ echo $fields['interior'].' | ';}else { echo ''; };?><?php if (isset( $fields['epamileage'])){ echo $fields['epamileage'];}else { echo ''; };?></p>
<p class="result-price"><?php include(TEMPLATEPATH."/functions/var/default-box-one.php");
//echo $symbols['currency'];
##### New ##########
// echo number_format($fields['price']);
##### End ##########
?>
<span id="calPriceInAud<?php echo $callPriceInAudCounter; ?>">Calculating...</span>
<script>
//Calculator.js
//function CarCostCalculator(enteredPriceInYen,cubicMeters,complianceFee,serviceFee,inventoryItemID)
CarCostCalculator(<?php echo $fields['price']; ?>,14, 2500, 1100,<?php echo do_shortcode('[convert number=1 from="usd" to="aud"]');?>)
</script>
</p>
</div> <!-- result detail wrapper ends -->
</div> <!-- result car ends -->
<?php endforeach; else: ?>
<p style="padding:30px;"><?php _e('Sorry, no listings matched your criteria.','language');?></p>
<?php endif; ?>
<div class="bottom-pagination"> <!-- Pagination starts -->
<p><a id="link" href="#top"><?php _e('BACK TO TOP','language');?></a></p>
<p class="paging">
<?php cps_show_pagination() ?>
</p>
</div> <!-- Pagination ends -->
</div>
<?php
exit;
}
As you can see
CarCostCalculator(<?php echo $fields['price']; ?>,14, 2500, 1100,<?php echo do_shortcode('[convert number=1 from="usd" to="aud"]');?>)
has do_shortcode('[convert number=1 from="usd" to="aud"]') but it doesnt work. But works fine on the template file.
do_shortcode('[convert number=1 from="usd" to="aud"]')to work? – user1889007 Feb 24 at 4:18