• Resolved netschmiede24

    (@netschmiede24)


    Hi there,

    I am trying to refine a SEARCH page for searching within custom posts from a pod named “haendler”.

    I added this snippet: https://docs.pods.io/code-snippets/using-pods-templates-for-search/#page-header-1347 – and yes, it now shows the pods excerpts.

    However, I do not want the excerpts to be shown, but rather an output from a pod template called “haendler-archive”.

    So I added a “content-search.php” file to my child theme. The template starts with

    <?php

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    And at the point where it called for the_excerpt() – I altered it to do a shortcode like this:

    <?php echo do_shortcode("[pods name='haendler' template='haendler-archive' id='the_ID();' ]"); ?>

    However, the part id=’the_ID();’ does not work. If I leave this completely out, it will list all pod entries. If I change it to a particular post ID as in id=’1225′, it will show one entry. How do I get the actual ID of the item into that shortcode?

    On a second note – how do I get the search string into the header? The search.php has the following line:

    <h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s'), '<span>' . get_search_query() . '</span>' ); ?></h1>

    However, the search results URL for searching “mysearch” looks like this:
    https://mydomain.com/?s&_s=mysearch
    Altering %s with %_s does not give any results and breaks the page.

    Any input is appreciated!

    Thanks,
    Astrid

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.