This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

the option does not work

the option does not work

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #20653
    klipingkliping
    Participant

    the option does not work, I don´t want to see the url of the image, can you help me please?

    http://prntscr.com/m3yjde

    http://prntscr.com/m3yk2i

    #20654
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Thank you for the details, it helps me a lot!

    I think you are looking at the wrong search instance options. Make sure to edit the search ID 1, where I see the description is still enabled. Turning that off will disable the content.

    I hope this helps!

    #20655
    klipingkliping
    Participant

    You cannot access this content.

    #20657
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    It might be part of the WordPress generated excerpt from a shortcode or somathing. Try this configuration: https://i.imgur.com/U6zloZc.png
    This will execute the shortcodes and use the content as the main field.

    #20658
    klipingkliping
    Participant

    little by little it’s better

    but now I want it to start with 200 characters and start with the first

    http://prntscr.com/m3zp2l

    http://prntscr.com/m3zpkw

    #20663
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    The ‘Description context’ option is not for removing the first X characters from the results content. That is only possible via a custom code.

    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case! Change the $remove variable to the number of characters you want to remove.

    add_filter('asp_results', 'asp_remove_first_n_characters');
    function asp_remove_first_n_characters($results) {
        $remove = 200;
        foreach ($results as $k => &$r) {
            if ( strlen($r->content) > $remove )
                $r->content = substr($r->content, $remove);
        }
        return $results;
    }
    #20669
    klipingkliping
    Participant

    Hi, I would need this script to do the function to hide some words, is that possible?

    for example… my friend’s house is red

    can I hide the word “house”?

    it´s possible?

    very thanks

    #20681
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    Try this modified version of the code. Enter the keywords to be replaced to the $words variable, comma separated.

    add_filter('asp_results', 'asp_remove_first_n_characters');
    function asp_remove_first_n_characters($results) {
        $remove = 200;              // Enter the length to cut
        $words = 'word1, word2';    // Enter the words to replace
    
        // Replace the keywords
        $words = explode(',', $words);
        foreach ( $words as $wk => &$word ) {
            $word = trim($word);
            if ( $word != '' )
                unset($words[$wk]);
        }
        if ( count($words) > 0 ) {
            // implode() words into a pipe-delimited string
            $pattern = "/\b(" . implode("|", $words) . ")\b/i";
            foreach ($results as $k => &$r) {
                $r->content = preg_replace($pattern, "", $r->content);
            }
        }
    
        // Trim the length
        foreach ($results as $k => &$r) {
            if ( strlen($r->content) > $remove )
                $r->content = substr($r->content, $remove);
        }
        return $results;
    }
    #20686
    klipingkliping
    Participant

    last question, I have this example…

    In my admin I have this configuration http://prntscr.com/m4r8ls

    and my front end I have http://prntscr.com/m4r9mi

    I need to look for me in the title of the post http://prntscr.com/m4rdsa

    very thanks and I sorry for my English

    #20690
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    I think that field ‘pyre_title_field’ is not the same as the post title, it does not contain the title, that is why it’s not working. The post title is not a custom field, that cannot be used for filtering.

    #20694
    klipingkliping
    Participant

    and what solution would there be to be able to filter through the entry field?

    #20698
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi,

    The title field cannot be used for that, but maybe you could for example create a custom field with the data you need – copy there the title, or part of the title. Then use that for the filter, that should work.
    Another possibility is to create a custom taxonomy.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.