The shortcode [event_booking_form event_id="181"]
returns the following garbled content:
http://blogg.regjeringen.no/euikt15/pamelding-til-euikt15/
Per Soderlind
Hi Per,
I’ve not been able to replicate this. How are you using the shortcode? Just in page/post content?
This could be a conflict with another plug-in (or some custom code). As an example, I recently saw something similar where a user had created an [email]
shortcode, and had added the line:
add_filter( 'the_content', 'do_shortcode' );
This passed the HTML content of the event (containing the booking form) through do_shortcode
and meant HTML containing [email]
(e.g. <input name="eo_booking[email]"...>
) was altered, and caused the booking form to always reject a booking because no email was provided.
While I don’t think that exact same thing is happening here, the point is that anything acting on the the_content
could potentially cause this. If you’re not aware of any custom code you’ve added yourself that might cause this, then I’d recommend deactivating other plug-ins to identify if there is a conflict. If there is, I’d be happy to take a look to see if they problem can be worked around.
Stephen Harris
Thank you for pointing me in the right direction. I found the reason (i.e. my code). I’m modifying an oembed and have disabled wptexturize and wpautop. I add it back for the part of the content that’s not part of the oembed using the following code:
function nettv_no_autop($content) {
$new_content = '';
$pattern_full = '{(<div class="webBroadcastBlock">.*?</div><!--/webBroadcastBlock-->)}is';
$pattern_contents = '{(<div class="webBroadcastBlock">(.*?)</div><!--/webBroadcastBlock-->)}is';
$pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($pieces as $piece) {
if (preg_match($pattern_contents, $piece, $matches)) {
$new_content .= $matches[1];
} else {
$new_content .= wptexturize(wpautop($piece));
}
}
return $new_content;}
remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');add_filter('the_content', 'nettv_no_autop', 99);
Back to the drawing board :/
Per Soderlind