Forums › Forums › Search & Filter Pro › Link back to search and filter results from post detail
- This topic has 9 replies, 2 voices, and was last updated 8 years, 6 months ago by Trevor.
-
Anonymous(Private) May 5, 2016 at 7:02 pm #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 postshttp://www.livit.cz/fotka-4/ see on the right BARVA (color)
Trevor(Private) May 6, 2016 at 9:00 am #44854That 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(Private) May 6, 2016 at 9:12 am #44862Hi 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
JanTrevor(Private) May 6, 2016 at 9:43 am #44865This 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.
Trevor(Private) May 6, 2016 at 10:28 am #44867So, 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]
-
AuthorPosts