Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Skipping characters for summarytext
- This topic has 4 replies, 2 voices, and was last updated 10 years, 6 months ago by
maarten19855.
-
AuthorPosts
-
December 6, 2015 at 6:12 pm #6921
maarten19855
ParticipantHi,
The first X characters on every post are always the same. So for the summary shown in the search results for ajax search pro I would like to skip X characters by default. How can I set a default characters to skip before taking the content shown in the results? Or perhaps add some code at the beginning of the paragraph I want to show per page?
Both can be seen when you use my main ajax search box on the website provided.
Thanks in advance!
Regards,
-
This topic was modified 10 years, 6 months ago by
maarten19855.
December 7, 2015 at 10:20 am #6925Ernest Marcinko
KeymasterHi!
Only by using a custom code, but luckily you don’t have to edit any of the plugin files, so this should be update-proof as well.
Try putting this code to your currently active theme folder, into the functions.php file:
[php]
add_filter( ‘asp_result_content_after_prostproc’, ‘asp_cut_from_content’, 1, 1 );function asp_cut_from_content( $content ) {
// Change this to the number of characters you want to cut
$charaters_to_cut = 50;return substr($content, $charaters_to_cut);
}
[/php]Change the $characters_to_cut variable to the number of characters you want to remove from the beginning.
December 7, 2015 at 12:17 pm #6926maarten19855
ParticipantThanks for the reply and the code Ernest. It seems to work fine with just 50 characters to skip. But when I choose to skip the first 600 characters it doesn’t show the description. The only thing showing is the title of the page. Is there a max characters to which the plugin uses the description. I need it to skip the first 600 characters.
December 7, 2015 at 12:36 pm #6927Ernest Marcinko
KeymasterYes, you probably need to increase the description length. By default it’s 130 characters. You can change that on the Layout Options -> Results Layout panel with the Description (content) length option. I recommed trying like 730 at first, and perhaps increasing it until you start seeing the description.
December 7, 2015 at 1:05 pm #6928maarten19855
ParticipantAh, why didn’t I think of that :). Thanks, it works perfectly now!
-
This topic was modified 10 years, 6 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.