How to load page template according to the Searched Page

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 … Read more

Blog template with different header to rest of site

Try this: if ( !is_home() && !is_cart() && !is_checkout() && !is_account_page() ) : if ( is_page( ‘contact-us’ ) ): get_template_part( ‘template-parts/header/header’, ‘map’ ); else: get_template_part( ‘template-parts/header/header’, ‘slider’ ); endif; endif; is_home() will return true if the current page/query is for the blog homepage, otherwise it returns false. You can read up about is_home() on the … Read more

different sidebars depending on template (is_page_template is not working)

One possiblilty: Keep the new code in sidebar.php in your child theme. In blog-page.php, change the line get_sidebar(‘blog-sidebar’); to do_action( ‘storefront_sidebar’ ); (as in an original page.php). Tested in a blog-page.php page template without custom query and loop, and also no woocommerce installed, this should work. If not, the custom query and loop might interfere. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)