Forum Replies Created
-
AuthorPosts
-
Hi again Chris,
It works like a charm now.
Thanks for all your help.
number_format is also OK.
Have a good day and a good weekend
Do you know why the PHP function number_format is not working ?
<p class=”prettyprint prettyprinted”><span class=”pln”> $html </span><span class=”pun”>=</span><span class=”pln”> number_format</span><span class=”pun”>(</span><span class=”pln”> $price</span><span class=”pun”>,</span> <span class=”lit”>0</span><span class=”pun”>,</span> <span class=”str”>’,'</span><span class=”pun”>,</span> <span class=”str”>’ ‘</span> <span class=”pun”>)</span> <span class=”pun”>.</span> <span class=”str”>’ € ‘</span><span class=”pun”>;</span></p>
ThanksHi Chris,
Thanks for the updated code.
I’m always having trouble displaying price.
I returns “ARRAY” value for $price.
here is the updated function :
function myfilter($props, $postid, $poi) {
$price = get_post_meta( $postid, ‘annonce_prix’ );
$html = $price;
$html .= ‘ €’;
if ( has_term( ‘location’, ‘offre’, $postid ) )
$html .= ‘<small> / mois</small>’;
if ( has_term( ‘location-saisonniere’, ‘offre’, $postid ) )
$html .= ‘<small> / nuit</small>’;
$props[‘prix’] = $html;
return $props;}
Mashup : <span class=”price label label-warning”>{{{poi.props.prix}}}</span>
Thanks for your help
Sorry there is no € symbol after {{poi.props.prix}}.
Hi Chris,
Sure, here it is :
<h3>{{{poi.title}}}</h3> {{{poi.thumbnail}}} <br /> <ul class="infos"> <# if (poi.props.annonce_surface) { #> <i class="fal fa-home" aria-hidden="true"></i> {{poi.props.annonce_surface}} m² <# } #> <i class="fal fa-bed" aria-hidden="true"></i> {{poi.props.annonce_chambres}} chambre(s) <i class="fal fa-bath" aria-hidden="true"></i> {{poi.props.annonce_sdb}} SDB {{poi.props.prix}} €
Maybe do you prefer WP admin access to check what’s wrong ?
Hi Chris,
Thanks for your feedback,
php function number_format doesn’t work it returns no value.
Here is my new code.
function myfilter($props, $postid, $poi) {
$html .= ‘<span class=”price label label-warning”>’;
$price = get_post_meta( $postid, ‘annonce_prix’ );
$html .= $price .’ €’;
if ( has_term( ‘location’, ‘offre’, $postid ) )
$html .= ‘<small>/ mois</small>’;
if ( has_term( ‘location-saisonniere’, ‘offre’, $postid ) )
$html .= ‘<small>/ nuit</small>’;
$html .= ‘</span>’;
$props[‘prix’] = $html;
return $props;
}Now it returns array for $price value & not displaying HTML tags
Do you have an idea of the problem ?
Many thanks for your help.
Hi Chris,
Thanks for the example.
I tried your code who it seemed to be OK but it returns nothing… no value.
I tried replacing $price value with $price = get_post_meta( $postid, ‘annonce_prix’ );
Do you have an idea what is the problem?
Thanks in advance for your help
Hi Chris,
Are you talking about this functionnality :
<?php
function myfilter($props, $postid, $poi) {
$props[‘message’] = “Hello from post ” . $postid;
return $props;
}
add_filter(‘mappress_poi_props’, ‘myfilter’, 10, 3);
?>Thanks
Hi again Chris,
Sorry for all my questions but i modified the price value to a function so i can display the price easier on the website.
Is it possible to pass the function on the POI template ?
function annonce_post_price(){ ?>
<span class=”price label label-warning”> <?php $price = annonce_detail(‘annonce_prix’); echo number_format( $price, 0, ‘,’, ‘ ‘ );?> € <?php if ( has_term( ‘location’, ‘offre’ ) ) echo ‘<small>/ mois</small>’; ?> <?php if ( has_term( ‘location-saisonniere’, ‘offre’ ) ) echo ‘<small>/ nuit</small>’; ?></span>
<?php }Thanks
Hi Again Chris,
Thanks for your reply,
I just want to add custom text depending to the taxonomy of the post.
Can we retrieve taxonomy ID or slug ?
{{poi.props.annonce_prix}} € (ADD /month or /night)
how can i achieve this, please ?
Thanks
If calculation is not possible, i just need another function.
if a custom_post_type is from taxonomy value i need to add text to price label
– location i need to add / month
– summer location /night.
Is it possible to add this to the mashup-popup template ?
<span class=”price label label-warning”> {{poi.props.annonce_prix}} € <?php if ( has_term( ‘location’, ‘offre’ ) ) echo ‘<small>/ mois</small>’; ?> <?php if ( has_term( ‘location-saisonniere’, ‘offre’ ) ) echo ‘<small>/ nuit</small>’; ?></span>
Thank you
Hi Chris,
That works perfectly. Thanks for your quick help.
I don’t understand about point 2 on calculations ?
Could you please give me an example.
Many thanks
Hi Again Chris,
Is it possible to display a custom field is not empty <i class=””fal” aria-hidden=””true””></i> {{poi.props.annonce_surface}} m²
For the calculation stuff, i don’t see the <code class=”prettyprint prettyprinted”><span class=”pln”>mashup</span><span class=”pun”>-</span><span class=”pln”>tmpl</span><span class=”pun”>-</span><span class=”pln”>popup</span><span class=”pun”>.</span><span class=”pln”>php</span> file ?
Could you help me on this, thank you
Hi Chris,
I found a solution for this,
Generate the map with PHP using this :
<?php
$map = new Mappress_Map(array(‘query’ => $args, ‘height’ => 500));
echo $map->display();?>
Thanks
Hi Chris,
I tried to do this but it doesn’t work for me.
Here is the complete mashup code :
<section id=”carte”>[mashup query="post_type=annonce&offre=vente&meta_key=annonce_type&meta_value=appartement&meta_key=annonce_surface&meta_value=100&meta_compare=>=" height="500"]</section><section></section><section>Order is important or not ?</section><section></section><section>Thanks in advance for your help</section>
-
AuthorPosts