• Resolved Adwiz

    (@adwiz)


    I’m fine with the normal WordPress search functionality, except that it looks for the_excerpt which can be problematic on pages, where no excerpt field exists. That’s because the content often has submenus in the first 155 characters, making the output look silly. Could someone help me with the following options:

    1. Code to pull the page’s “description” tag instead of the excerpt. Every page I create has a description meta tag for SEO, so this would be fine. Ideally, having my code look for the_excerpt if it’s there, or the description tag if no excerpt exists.

    2. Alternatively, some way to allow the admin area to include a field for creating an excerpt on pages. I have no idea if that’s even possible, never mind knowing how to do it if it is.

Viewing 5 replies - 1 through 5 (of 5 total)
  • DigitalSquid

    (@twelvefootsnowman)

    Are you using a specific SEO plugin for the descriptions or have you made your own custom field or meta tag for it?

    Thread Starter Adwiz

    (@adwiz)

    I’m using the All-in-One SEO pack plugin to generate the description meta.

    I think I’ve found a suitable solution to my problem, though. There’s a plugin called Page Excerpt by Jeremy Massel that I just tested out and it does a great job of presenting an excerpt field in the admin area for pages.

    Still would like to know if it’s possible to code the description meta tag directly into a loop like that used by the Search function.

    DigitalSquid

    (@twelvefootsnowman)

    It should be possible, the All-in-One SEO plugin uses Custom Fields to store the meta description for the page so all you’ll need to do is use get_post_meta() to get the info.

    Looking at the plugin, the Custom Field is called _aioseop_description so if you put something like this in your post loop:

    <?php echo get_post_meta($post->ID, '_aioseop_description', true); ?>

    It should give you the description.

    Thread Starter Adwiz

    (@adwiz)

    Thanks. Appreciate the help!

    I have the exact same problem. Took a look at your suggestion, Twelve, and it appears that everywhere that ‘_aioseop_description’ is called, it is already set to True. I can’t find any actual instance of it calling the excerpt instead of the description.

    Any further ideas?!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to get search results to use description tag instead of the_excerpt’ is closed to new replies.