Forums › Forums › Search & Filter Pro › How to show the currently selected title only
Tagged: category link Ajax
- This topic has 4 replies, 2 voices, and was last updated 7 years, 6 months ago by Anonymous.
-
Anonymous(Private) May 11, 2017 at 11:25 am #108195
Is there a way to have a link on a blog post that goes to a S&F Pro form result?
For example: A link to a category from a blog post that goes to the blog landing page but displays results only from that category? It would need to be dynamic too.
Any help with this would be much appreciated.
Anonymous(Private) May 11, 2017 at 7:33 pm #108335What I mean is, if a post is in a certain category can I put a snippet of PHP into the theme that will link to a page with a S&F Pro form that has that category selected and displays the results. It would be instead of having a separate category page.
For a more solid example I can send you to the two pages in question.
The form page:
Example Single post :
http://supersunhero.com/blog/signal-over-noise/
Where it shows the category, I want to link to the blog page and have it show the results from relevant category.
I hope that makes sense.
Anonymous(Private) May 12, 2017 at 11:59 am #108449Hi,
Yes exactly.
I’ve made a snippet that is half static half dynamic which works fine for my needs!
Thanks so much for your help.
And for what it’s worth this is the code I used:
<?php $categories = get_the_category(); if ( ! empty( $categories ) ) { echo '<a href="/blog/?_sft_category=' . esc_html( $categories[0]->slug ) . '">' . esc_html( $categories[0]->name ) . '</a>'; }?>
-
AuthorPosts