Forums Forums Search & Filter Pro Link back to search and filter results from post detail

Viewing 10 posts - 1 through 10 (of 10 total)
  • Anonymous
    #44807

    Dears,
    Is there any way how to make link from post detail back to search and filter resuls of one atribute?
    For example I use custom field color for posts. From posts detail with set blue color I would like to link back to results for BLUE color posts

    http://www.livit.cz/fotka-4/ see on the right BARVA (color)

    Trevor
    #44854

    That link has a wrongly formed url.

    You want to be able to dynamically make the correct search url to call that color?

    Does your theme allow you to place a shortcode there? If so, you can use a plugin that will allow you to put a single shortcode there for all posts, but that shortcode can contain php that will then call from the ACF field the correct color and construct the url that you desire.

    Anonymous
    #44862

    Hi I am using ACF – this is Link in admin

    Kategorie: <a href="<strong">"http://www.livit.cz/fotogalerie-vysledky/?_sfm_Kategorie=[acf field=" {$field_name}"]"></strong>[acf field="Kategorie"]</a><br>
    Barva: <a>http://www.livit.cz/fotogalerie-vysledky/?_sfm_barva=[acf field=" barva"]</strong>">[acf field="barva"]</a>

    I did not find any suitable plugin for this, could recommend me some that will be able to link to display results of SearchForm
    Thanks
    Jan

    Trevor
    #44865

    This is the plugin you need:

    https://wordpress.org/plugins/post-snippets/

    But, you need to call the ACF fields using the php method. Let me have my breakfast, and I will give it a go for you. In the meantime, install that plugin.

    Anonymous
    #44866

    Bon Apetit Trevor and thanks for your help. Plugin is installed

    Trevor
    #44867

    So, to use this plugin, in WP Admin go to Settings -> Post Snippets

    Click Add New Snippet

    In the title, give it a shortcode name (must be a valid WP slug name), for example:

    my-color-link

    Check the Shortcode and PHP Code checkboxes.

    In the Snippet textarea copy and paste this:

    $livit_kategorie = get_field('Kategorie');
    $livit_barva = get_field('barva');
    $livit_url = get_site_url() . '/fotogalerie-vysledky/';
    echo '<strong><span style="color: #c62daa;">Kategorie</span></strong>: <a href="';
    echo $livit_url;
    echo '?_sfm_Kategorie=';
    echo $livit_kategorie;
    echo '">';
    echo $livit_kategorie;
    echo '</a><br /><strong><span style="color: #c62daa;">Barva</span></strong>: <a href="';
    echo $livit_url;
    echo '?_sfm_barva=';
    echo $livit_barva;
    echo '">';
    echo $livit_barva;
    echo '</a>';

    There may be errors in that 😉 as I cannot test it here.

    Now all you do is place that shortcode where you want those two lines:

    [my-color-link]

    Anonymous
    #44869

    perfect. i will split it into two commands, but I will do it myselfe. Perfect help, thank you

    Trevor
    #44947

    Is this now resolved and can I close the thread?

    Anonymous
    #44956

    Yes, where can I mark it as solved?
    Thanks
    Jan

    Trevor
    #44957

    I will do that, thanks 🙂

Viewing 10 posts - 1 through 10 (of 10 total)