0

I'm using WordPress theme Twenty Ninteen and trying to make a travel blog with the help of travel affiliate API get from Travelpayouts.

<script charset="utf-8" src="//www.travelpayouts.com/widgets/920a6b8c6fc20070013d2e04f690210d.js?v=1649" async></script>

This is form code to display on pages/post, if I use on any post on page code working fine but I need to add this code in the header to display like.

form image

I try to use the plugin for header & footer to paste the code & display but via plugin code working in the footer but in header nothing display.

0

You need to edit header.php of your theme and insert the script there right after the site navigation.

I try to use the plugin for header & footer to paste the code & display but via plugin code working in the footer but in header nothing display.

Plugins fail to insert this in header because these plugins use wp-header hook which output in <head> tag and not in the <body> tag, so the output is not visible.

While those plugins which uses wp_footer hook outputs everything within <body> tag, so the output is visible.

  • thanks its working and i got it one that how can i use in header. i have two questions there. 1. How can i be specific on some pages to display 2. Once i click search it goes to another page i want to display the result in the body. – FormaL Apr 3 at 9:17
  • For display on specific pages use conditional template tag is_page() DOCS. For result display on same consult the documentation of affiliate API. – Qaisar Feroz Apr 3 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.