Notifications
Clear all

Advanced search including date fields as the default home page

6 Posts
2 Users
1 Reactions
820 Views
Posts: 4
 Arik
Customer
Topic starter
(@arash-kermani-kolankeh)
Member
Joined: 4 years ago

I need to have the advanced search of the wpforo forums to be the default page of my website. My wpforo forum has some "Topic Custom Fields" including two Date fields. The Date fields should also be included in the search.

Now the advanced search works, but the dates do not affect the results, also I can not find the option which could be set to see the advanced search on a separate page (which could be set as the home page of my website). Please note that I am not talking about the creation date of the post, but about the Date fields. Please see the attached image.

I would be really thankful if one could guide me to solve these two problems.

Screenshot from 2021 01 15 10 38 37
5 Replies
Astghik
Posts: 6199
Admin
(@astgh)
Illustrious Member
Joined: 7 years ago

Hi @arash-kermani-kolankeh

As Sofy already mentioned here the Filter by custom fields just searches values in the post content. So you cannot filter by date using the date custom field date value. You cannot filter by the date using the custom fields. 

You'll need to use the Search in date period Filter. 

Reply
Posts: 4
 Arik
Customer
Topic starter
(@arash-kermani-kolankeh)
Member
Joined: 4 years ago

Thank you very much for your answer. And how could I make the advanced search page to be my home page? Sorry if the question is too naive :p

If you have any advice how to make a "Search in date period Filter" I would also be really thankful. Shall I do it programmatically?

 

Reply
3 Replies
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6199

@arash-kermani-kolankeh,

And how could I make the advanced search page to be my home page? Sorry if the question is too naive :p

Do you mean a sitewide search? Or you just need to add the wpFro search in the home page? 

If you have any advice how to make a "Search in date period Filter" I would also be really thankful. Shall I do it programmatically?

Yes, this should be done by custom code, however, there is only one simple solution we can provide you.

You can just change the select box to input and enter the number on the day for search.

If the solution is enough for you, follow the steps below:

1. Open the following file: wp-content/plugins/wpforo/wpf-includes/class-template.php

2. Find these lines:

<select name="wpfd" class="wpfw-90 wpfd">
<option value="0" <?php echo $date_period === 0 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Any Date') ?></option>
<option value="1" <?php echo $date_period === 1 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Last 24 hours') ?></option>
<option value="7" <?php echo $date_period === 7 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Last Week') ?></option>
<option value="30" <?php echo $date_period === 30 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Last Month') ?></option>
<option value="90" <?php echo $date_period === 90 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Last 3 Months') ?></option>
<option value="180" <?php echo $date_period === 180 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Last 6 Months') ?></option>
<option value="365" <?php echo $date_period === 365 ? 'selected' : '' ?>>&nbsp;<?php wpforo_phrase('Last Year ago') ?></option>
</select>

3. Replace it with the following one: 

<input class="wpfs wpfw-90" type="number" name="wpfd" value="<?php echo $date_period ?>">
Reply
 Arik
Customer
(@arash-kermani-kolankeh)
Joined: 4 years ago

Member
Posts: 4

Thank you very much for your answer @astghik !

you asked "Do you mean a sitewide search? Or you just need to add the wpFro search in the home page?":

I mean to have the advanced search of the wpForo as the homepage of my website. Now the advanced search appears just after one does a search. This is the address of the advanced search page:

...mywebsite.com/community/?wpfs=

I want this page to be the home page of my website, so that the advanced search will be the first page the users sees when they open my website.

Should it be done using a shortcode? Or

shall I redirect the ...mywebsite.com to ...mywebsite.com/community/?wpfs= .

For neither case I could found a solution.

 

I appreciate your answer in advance.

Reply
Astghik
Admin
(@astgh)
Joined: 7 years ago

Illustrious Member
Posts: 6199

@arash-kermani-kolankeh,

I'm really sorry, but wpForo doesn't have such a feature. You can either add the wpForo Search Widget in the Home page sidebar or do it yourself by custom code. 

Reply
Share:
Scroll to top