WordPress.org

Support

Support » Plugins and Hacks » show meta description in search result

show meta description in search result

  • I want to display meta description in the search result instead of excerpt. I tried to change the sf.php file, but after making some changes it was showing the following error:
    Parse error: syntax error, unexpected T_STRING in /home/content/01/10893301/html/en/wp-content/plugins/ajaxy-search-form/sf.php on line 1

    I changed the post_object function changing
    $pst->post_content = $this->get_text_words(get_the_content($pst->ID) ,(int)$this->get_excerpt_count());
    to
    $pst->post_content = $this->get_text_words(get_post_meta($pst->ID) ,(int)$this->get_excerpt_count());

    What should I do?
    Is it possible to show the meta description in the search result?

    https://wordpress.org/plugins/ajaxy-search-form/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Naji Amer

    @n-for-all

    get_post_meta returns a list of custom fields, the meta description is the excerpt of the post by default, unless you are using a plugin to edit the meta fields of the post and hence you need to get that field value from the plugin and not from wordpress.

    I’ll need to add the shortcode or something like that in the plugin file after using any plugin for that, right?
    But why it gives me error on changing the plugin file?
    Also my site stopped working due to the changes in the plugin file.

    Plugin Author Naji Amer

    @n-for-all

    I’ll need to add the shortcode or something like that in the plugin file after using any plugin for that, right?

    no thats not right, this plugin doesn’t have any shortcodes.

    But why it gives me error on changing the plugin file?

    i am not sure what you did there, restore back the plugin file to its original state

    as for any custom adds or development, this is paid, please contact me on my email

    Plugin Author Naji Amer

    @n-for-all

    I’ll need to add the shortcode or something like that in the plugin file after using any plugin for that, right?

    no thats not right, this plugin doesn’t have any shortcodes.

    But why it gives me error on changing the plugin file?

    i am not sure what you did there, restore back the plugin file to its original state

    as for any custom adds or development, this is paid, please contact me on my email

    Thanks for quick reply, I’ve restored the plugin file already. It works fine after restoring the file.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘show meta description in search result’ is closed to new replies.