How to load page template according to the Searched Page

I have a search form which uses RELEVANSSI plugin to perform search and display Search Results. On my Search Results pag

I have a search form which uses RELEVANSSI plugin to perform search and display Search Results. On my Search Results page there is pagination and Search Filters(hyperlinks) which allows user to show 10, 20 or 30 records on screen.

The Issue: In my website I have some internal pages which have different HEADER AND FOOTER and a Search BOX. By adding some checks If user performs search from these internal pages then it will load relevant and correct header and footer. But if I click on Pagination Filter or Search Filters (Show 10 Records, show 20 records) then it will load main website header and footer.

I need a way to pass some variable which recognizes that from which page user come and according to that variable it will load header and footer.

Thanks

I have a search form which uses RELEVANSSI plugin to perform search and display Search Results. On my Search Results page there is pagination and Search Filters(hyperlinks) which allows user to show 10, 20 or 30 records on screen.

The Issue: In my website I have some internal pages which have different HEADER AND FOOTER and a Search BOX. By adding some checks If user performs search from these internal pages then it will load relevant and correct header and footer. But if I click on Pagination Filter or Search Filters (Show 10 Records, show 20 records) then it will load main website header and footer.

I need a way to pass some variable which recognizes that from which page user come and according to that variable it will load header and footer.

Thanks

Share Improve this question edited Mar 19, 2019 at 7:55 Eshban Bahadur asked Mar 19, 2019 at 7:43 Eshban BahadurEshban Bahadur 1251 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Just use wp_get_referer(), and a few other functions to get the simple name of the referring page, e.g.

if (basename(parse_url(wp_get_referer(), PHP_URL_PATH)) == 'my-search-page') {

(Or you could use string searching or matching instead of parse_urland basename).

(Also note wp_get_referer is deliberately misspelled. It originates in a misspelling in one of the web standards)

Addendum
Might have to tweak this a bit to deal with the case where there's no referrer (e.g. a bookmark was used to get to the page).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745634049a4637280.html

相关推荐

  • How to load page template according to the Searched Page

    I have a search form which uses RELEVANSSI plugin to perform search and display Search Results. On my Search Results pag

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信