-
AuthorSearch Results
-
October 5, 2016 at 3:49 pm #62230
In reply to: Custom search results
TrevorParticipantHi, there are, in effect, three potential results templates in Shortcode mode for EACH form:
Let us say the form has an ID of 6799.
1. The plugin first looks in the theme folder, search-filter sub-folder for a file called 6799.php
2. If it does not find that, THEN it uses the results.php file in that same folder
3. If it does not find that it uses the results.php file in the plugin templates folderIf you want to make the results template specific to a form, use the numbered option.
October 5, 2016 at 3:43 pm #62225In reply to: Custom search results
AnonymousInactiveOne question, by changing the results.php you mean to change that file on the plugin or locally on the theme?. I ask because I want to know if this will affect all the Search Forms.
Thanks for your kindly help Trevor.
October 5, 2016 at 11:08 am #62142In reply to: Search result directly to post/page
TrevorParticipantI suppose it might be, but you would need to code this yourself, and it would only work if the visitor had javascript enabled.
If you were using the shortcode method, which use the results.php file, you could add code to check if only one result found, and if it was, output a simple javascript command to load that page. This Stack Exchange page shows what that might look like:
http://stackoverflow.com/questions/7066527/redirect-a-user-after-the-headers-have-been-sent
October 5, 2016 at 11:01 am #62140In reply to: Remove "Page 1 of 1"
TrevorParticipantHi Joy
Did you make your own copy of the results.php file, as shown here:
October 5, 2016 at 10:40 am #62122In reply to: Custom search results
TrevorParticipantGood morning Rai
To do the former option would be easier, in part.
S&F Pro already has the option to sort results by Post Type, so all you need to do is to format the results differently.
The standard results.php is structured like this:
<?php while ($query->have_posts()) { $query->the_post(); ?> OUTPUT THE POST HERE <?php } ?>Instead you would do:
<?php while ($query->have_posts()) { $query->the_post(); switch (get_post_type( get_the_ID() )) { case 'Post Type A': ?> OUTPUT THE POST HERE if it is Post Type A <?php break; case 'Post Type B': ?> OUTPUT THE POST HERE if it is Post Type B <?php break; case 'Post Type C': ?> OUTPUT THE POST HERE if it is Post Type C <?php break; } } ?>You would have a little bit more code if you needed to detect the start and end of the output of each post type (for example to start a background box or add a sub-title.
As to sort options, I do not know.
October 5, 2016 at 12:20 am #62069Topic: Remove "Page 1 of 1"
in forum Search & Filter Pro
AnonymousInactiveHello,
I want to remove this from the Search&Filter results.php file:
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />I just want it removed from the top of the page and not the bottom.
Could you give me the code to put in my child-theme functions.php file to have it not show. I’m a beginner and not sure how to code it.
Thank you,
JoyOctober 4, 2016 at 8:08 pm #62023In reply to: Custom search results
AnonymousInactiveHi Trevor,
What I was thinking was to conditionate the results.php depending on the template we will use and then print the results depending of the custom post types.
I have a developer so, if you help to track a way to do it, we can do it.
And I imagine if my idea is not makeable, the second option, to separate the page in differents tabs, each one with their one filters and results, right?.
Help me to see the way Trevor.
October 4, 2016 at 7:44 pm #62009In reply to: Custom search results
TrevorParticipantGreat video.
You want a series of results, from multiple post types, which would normally come out all mixed up, to be sorted and probably have a sub-title as each type starts?
If you know what the custom post types are beforehand, and you use the shortcode method, which then gives you the use of the results.php file, the results come in an array. It must be possible to pre-sort that array before looping through it, and using local variables to detect when the post type changes (and insert the title at that point), and what it is for each post type, where you can use a php switch case structure to have different html output around the fields, and even different fields.
But that is a lot of coding. Probably 15-20 hours, and that will not be cheap, not that I or Ross have any free time anyway 🙁
October 4, 2016 at 1:05 pm #61870In reply to: Media file as hyperlink
AnonymousInactiveI tried to fix it with help of the link you just sent, but unfortenately, I can’t find my theme folder at all. I thought I found a list with some of these folders (via Editor), but I wasn’t able to add another folder overthere. Furthermore, I couldn’t find a folder/file called: wp-content\plugins\search-filter\templates\results.php…
October 4, 2016 at 11:29 am #61852In reply to: Media file as hyperlink
AnonymousInactiveHi Trevor,
Thanks for your fast reply! I already managed to place a second search form on a specific page. 🙂 However, obtaining image results as hyperlinks isn’t working yet. How and where should I edit the results.php template file?
Kind regards,
Stan Thijssen
-
AuthorSearch Results
-
Search Results
-
Topic: Remove "Page 1 of 1"
Hello,
I want to remove this from the Search&Filter results.php file:
Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />I just want it removed from the top of the page and not the bottom.
Could you give me the code to put in my child-theme functions.php file to have it not show. I’m a beginner and not sure how to code it.
Thank you,
Joy