• Resolved jdyach

    (@jdyach)


    Is there a way to use the AIOSEO meta description on the WordPress site search results page (not referring search engine results)?

    I had found a snippet to do this with Yoast SEO, but looking for one that would work with this plugin.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Shivam Tyagi

    (@shivamtyagi)

    Hi @jdyach,

    With All in One SEO (AIOSEO), you can indeed set a meta description for your WordPress site’s search results page without needing any additional code snippets. This feature is built right into our plugin settings.

    Here’s how you can do it:

    1. Navigate to All in One SEO > Search Appearance > Archives in your WordPress dashboard.
    2. Scroll down to the Search Page section.
    3. You’ll find a toggle for “Show in Search Results”, which is set to “No” by default. Simply switch this toggle to “Yes”.
    4. Once you enable this, you can enter your desired meta description in the Meta Description field.
    5. To make your meta description dynamic, you can use the “Search Term” smart tag, which will automatically include the search term that was used in the search.

    We’ve also covered this in our documentation along with a video here-
    https://aioseo.com/docs/setting-the-seo-title-and-description-format-for-the-search-results-page/

    Thread Starter jdyach

    (@jdyach)

    Hi,

    Thanks for your reply, but what I was actually looking for was to have the results of the posts/pages/products listed on my search results page to use those posts/pages/products’ SEO descriptions that I set using AIOSEO.

    I was able to do that by copying the search results template to my child theme and replacing the description hook for the search results page.

    For anyone else who comes across this using the Avada theme, the file is /templates/blog-layout.php around line 329

    <div class="fusion-post-content-container">
    <?php
    // custom AIOSEO meta description for search results
    if ( is_search() ) {
    if (function_exists('aioseo')) {
    $aioseo_description = aioseo()->meta->metaData->getMetaData($post)->description;
    if(!empty($aioseo_description)) {
    $post_id = get_the_ID();
    $get_post = get_post($post_id);
    $meta_description = aioseo()->meta->description->getPostDescription($get_post);
      echo $meta_description;
    }
    }
    }else{
    /**
    * The avada_blog_post_content hook.
    *
    * @hooked avada_render_blog_post_content - 10 (outputs the post content wrapped with a container).
    */
    							do_action( 'avada_blog_post_content' );
    }
    ?>
    </div>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘*WP* search resuts page – use SEO description?’ is closed to new replies.