Add forum search results to WordPress search

Yes, that’s correct. I don’t know how the shortcode widget handles regular markup as it’s only intended to process a shortcode directly. The HTML widget should also execute any shortcodes present, but it might be confused due to the shortcode being wrapped inside an HTML attribute. In either case, I think the easiest solution is to put the entire iframe markup inside the shortcode, which should allow you to render it in either widget.

So edit the PHP Code field for your snippet to this:

<?php
$height = 1000;
$width = 100;
$url = '/discoursesearch.php?s=' . urlencode(get_search_query());
echo '<iframe src="' . $url . '" height="' . $height . '" width="' . $width . '%" style="height:' . $height . 'px;width:' . $width . '%;"></iframe>';

Whether you’re using the HTML or Shortcode widget, remove everything but the shortcode itself and test again.

P.S.
The above code is untested, but fingers crossed it will work first time. :sweat_smile:

2 Likes