Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search Results showing my Editor code
- This topic has 1 reply, 2 voices, and was last updated 10 years, 7 months ago by
Ernest Marcinko.
-
AuthorPosts
-
October 12, 2015 at 3:58 am #6201
sladestyle
ParticipantHi, I recently purchased your plugin and have begun the setup process. When testing it has a tendancy to show my Admin shortcode/code in the search results. For example: if you input “year” in the search field you get what’s shown on the attachment.
I cannot figure out how to disable any sort of Admin edit info in the search results.
Thanks,
SladeOctober 12, 2015 at 11:12 am #6206Ernest Marcinko
KeymasterHi!
After a few hours (!) of debugging I found that for some yet unknown reason some of the Enfold layout builder shortcodes are not registered in Ajax requests. I’m nor sure if this is a global theme issues, or just your case, or some misconfiguration.
The best solution would be to ask the theme author how to enable the “av_section”, “av_heading” and all the other shortcodes in ajax requests as well. It’s probably either a minor bug or a configuration issue. I’m 100% sure that those shortcodes must exist in ajax requests, otherwise every ajax powered plugin that queries posts contents will fail.
Otherwise I can only suggest 2 “hack” solutions.
1. I’ve put the following code at the end of the theme functions.php file:
[php]// Force to return the shortcode content only
function x12_return_just_content($atts, $content) {
return do_shortcode($content);
}// Force to return an empty string
function x12_return_empty_content($atts, $content) {
return "";
}add_action( ‘asp_before_search’, ‘x12_empty_unregistered_shortcodes’);
function x12_empty_unregistered_shortcodes() {
// The list is incomplete!add_shortcode( ‘av_hr’, ‘x12_return_empty_content’ );
add_shortcode( ‘av_image’, ‘x12_return_empty_content’ );
add_shortcode( ‘av_button’, ‘x12_return_empty_content’ );
add_shortcode( ‘av_two_third’, ‘x12_return_just_content’ );
add_shortcode( ‘av_heading’, ‘x12_return_empty_content’ );
add_shortcode( ‘av_one_half’, ‘x12_return_just_content’ );
add_shortcode( ‘av_one_full’, ‘x12_return_just_content’ );
add_shortcode( ‘av_one_third’, ‘x12_return_just_content’ );
add_shortcode( ‘av_three_fourth’, ‘x12_return_just_content’ );
add_shortcode( ‘av_one_fourth’, ‘x12_return_just_content’ );
add_shortcode( ‘av_section’, ‘x12_return_just_content’ );
add_shortcode( ‘av_textblock’, ‘x12_return_just_content’ );
}[/php]2. Another solution is shorter, but it removes the undefined content. In case, you can replace that code with this:
[php]
// Force to return an empty string
function x12_return_empty_content($atts, $content) {
return "";
}add_action( ‘asp_before_search’, ‘x12_empty_unregistered_shortcodes’);
function x12_empty_unregistered_shortcodes() {
add_shortcode( ‘av_section’, ‘x12_return_empty_content’ );
}[/php]I don’t fancy either of these solutions, but unless there is a way to turn on the registration of the layout editor shorcodes in ajax requests, I don’t think there is any better way.
-
AuthorPosts
- You must be logged in to reply to this topic.