Hiya,
I’m reasonably familiar with Sage 9, but this problem has popped up and I cannot seem to get the shortcode to work unless I hardcode the actual shortcode text into the template, not ideal.
OK so I have added a setting page and numerous options, the option in question is for a shortcode for Contact Form 7, this is saved via the settings API and so far we’re all good.
when I want to display the shortcode I’ve been grabbing the option from the API with this:
function sign_up_form(){
$sc = get_v('sign_up');
if(!empty($sc)){
return $sc;
}
}
this returns the shortcode and also works fine, ‘get_v’ grabs the option and in this case the result of that is: [contact-form-7 id=“188” title=“Sign Up”], so far so good.
Now I need to use that shortcode in a template file, so in my views/partials folder I’ve got a quick-contact.blade.php file with the following code:
@php $form = App\sign_up_form() @endphp
@php echo do_shortcode($form) @endphp
which outputs:
[contact-form-7 404 “Not Found”]
Now I know the shortcode is correct, when I run “@php echo do_shortcode(’[contact-form-7 id=“188” title=“Sign Up”]’) @endphp” instead of the two lines above the contact form appears.
I’m sure I’m making a basic mistake somewhere here but I can’t see it and it’s driving me mad! I’ve had a decent search around here for a solution without any joy… Any pointers much appreciated! TIA