How to insert php inside php…
-
I am using wp-favorites plugin in a classipress site
My aim is to incle the ad price in the page layout in the favorites page
I am trying to add some php code into the page template file, but not having much luck
Here is the existing code:
[please use the ‘code’ button to mark any posted code – the code below is broken; https://codex.www.ads-software.com/Forum_Welcome#Posting_Code ]
<?php
echo “<div class=’wpfp-span’>”;
if (!empty($user)):
if (!wpfp_is_user_favlist_public($user)):
echo “$user’s Favorite Posts.”;
else:
echo “$user’s list is not public.”;
endif;
endif;if ($wpfp_before):
echo “<p>”.$wpfp_before.”</p>”;
endif;echo “
- “;
- <h3>”;
echo “post_title .”‘>” . $p->post_title . “</h3>”;echo “post_title .”‘>”;
if(get_post_meta($post_id, ‘images’, true)) cp_single_image_legacy($post_id, get_option(‘medium_size_w’), get_option(‘medium_size_h’)); else cp_get_image($post_id, ‘medium’, 1);
echo ““;
echo substr(strip_tags($p->post_content), 0, 250).”…”;
echo “”;
wpfp_remove_favorite_link($post_id);
echo “ - “;
echo $wpfp_options[‘favorites_empty’];
echo “
if ($favorite_post_ids):
foreach ($favorite_post_ids as $post_id) {
$p = get_post($post_id);
global $post;
echo ““;
}else:
echo ““;
endif;
echo ““;
wpfp_clear_list_link();
echo “</div>”;
wpfp_cookie_warning();
?>The php code I want to insert is:
<?php if ( get_post_meta( $post->ID, ‘price’, true ) ) cp_get_price( $post->ID, ‘price’ ); else cp_get_price( $post->ID, ‘cp_price’ ); ?>
How can I do this?
I did just try adding the code like this:
if ( get_post_meta( $post->ID, ‘price’, true ) ) cp_get_price( $post->ID, ‘price’ ); else cp_get_price( $post->ID, ‘cp_price’ );
but it did not work ie: it does not call up the price and display it in the page
Any help will be greatly appreciated – thank you
- <h3>”;
- The topic ‘How to insert php inside php…’ is closed to new replies.