• Fred17

    (@f14m07)


    Hi,
    I created a snippet to create a shortcode. This code also works in a hook attached to the WP profile display. When I use this short code on a page I get an invalid JSON return error when I save the page. However the page is saved and the shortcode works. What do you think of that ? how to resolve this error ? This is the snippet :

    add_shortcode( 'carte_sur_page', function () {
    	$membership_id=1;
    	$wp_id=get_current_user_id();
    	$member = eme_get_members_by_wpid_membershipid($wp_id, $membership_id);
    	if (!empty($member)) {
    		$member=$member[0];
    		$answers=eme_get_member_answers($member['member_id']);
    		$coupon=$answers[0];
    		$conso=$answers[1];
    	?>
    	<h3>Vous avez déjà une carte de réduction</h3>
    	<li>Nombre de coupons disponibles : <?php echo $coupon['answer'] ?></li>
    	<li> Dates des navigations payées par carte : <?php echo $conso['answer'] ?></li>
    	<?php } });
Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    What JSON error are you receiving? Are you sure it is coming from this snippet, or could it originate elsewhere?

Viewing 1 replies (of 1 total)

The topic ‘JSON error with a shortcode on a page’ is closed to new replies.