Use global variables to pass values from the template to the header.
// in the template file
global $my_page_title;
$my_page_title="field value";
global $my_meta_description;
$my_meta_description = 'field value';
get_header();
// in the header file
global $my_page_title;
global $my_meta_description;
echo $my_page_title;
echo $my_meta_description;
Related Posts:
- New WP_Customize API – how does it work under the hood?
- How to add a new product type on woocommerce product types? [closed]
- Updating WordPress overwriting customization tweaks – strategies?
- How to customize the default HTML for WordPress Attachments
- wp_trim_words() does not trim the_content() in WordPress
- How to customize search result page title?
- In the new Theme Customizer API, how to send a value from the front back to the admin panel?
- page_template toggle between 2 templates + 2 permalinks for same post
- Make page template that is just an “include” of another?
- Custom php file in wordpress
- Selecting An image from the Media LIbrary on the frontend
- How do I perform a “get” call to an external API, and then display the JSON results on a page in my WordPress site?
- WordPress Template not affecting the working, keeps defaulting to the index.php template
- Recommend an open source, template driven website builder UI that produces a working WordPress site [closed]
- Change separators in HTML tags
- How to display post title & excerpt when mouse hovers on an image?
- Replace “WordPress” word in title of Dashboard
- For custom templates, is it better to use `template_include` or `type_template`?
- Create default_content layout template based on post id
- Remove template drop down for certain pages
- How do I add a new template to my site
- How to customize core admin pages within a theme?
- How can I make site-wide content editable, for example footer content
- Custom title, Bones theme
- Query post for ‘selected category’ in archive.php
- Showcase elementor templates
- How to get custom page template being edited in gutenberg editor
- Get Image from Media Library with the Title
- Add Custom API Call to WP-Login.php
- Get rid of title from static front page
- Make custom page look exactly as homepage
- Best practice – pages – ACF or inline coding
- How to hook up search results page to a back-end page?
- Save title as custom field on custom post type
- Keep Title and Description always
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- Is there a way to by-pass the pagination function on one custom template?
- How do I modify the size of the text in my page titles?
- Customizer JS API get value of customizer field
- Editing a post template
- WordPress archive index page
- Adding tags when creating new post
- How to add custom ‘layout’ buttons to wordpress editor?
- How to create custom layouts and static pages in themes for clients
- How to add span on WordPress Title for first and third word
- Custom Content Page
- Remove link from page title
- Create a Page template selector page
- Replace a ‘Title’ tag with a Custom Field
- Creating custom page template
- Force WordPress to load a specific template
- Dynamic Sidebars based on page name
- Translate custom template with WPML
- How To make Custom page of every Category
- title tag function
- custom email validation using javascript api with elementor pro and code snippets
- why won’t my custom css load with the enqueue method or any other method?
- Get /users/me details from WordPress backend
- mailchimp integration on a custom footer
- How to get the full product name by ignoring custom modification on it
- Conflict between Yoast SEO and my custom theme
- How to add a template – so that i can choose a different menu for some pages
- Need to replace some text string on a title
- How can I delete the word `Category:` from page titles? [duplicate]
- How can I add category variable inside posts?
- Why does a custom php code inside a custom template not get executed?
- Delete page titles
- Change meta-box title- “LearnDash Quiz Settings” to “Quiz Settings”
- wordpress custom posts page not showing
- How do I target this page specifically?
- How to use a custom playlist template:
- Still desperate about multiple TinyMCEs in widgets – is there any good solution to this yet?
- Displaying Child Page’s Information
- Getting a jQuery library to work in WordPress & Avada
- Use another theme template in my theme
- Redirect Every Instance of The Author Template Pages to Custom Author Pages
- Allow arbitrary text after page URL
- Taxonomy template by post type
- Show WP content on different PHP Sites
- Best way to create a page outside of the pages list
- Template setting is not saving in wordpress
- Make Terms Under Custom Taxonomy Use Specific Single.php Template
- Custom single page based on which custom page template is selected
- Single page template
- Adding css and js to a blank page created with custom template
- Modifying a local template
- Custom template not working for existing pages [closed]
- How to apply styles to the custom page template
- I need to make the title of the page dynamic in my custom plugin
- Create a page for each database table entries
- Different titles on homepage vs single based on category
- How to edit the new user email notification template
- Block Theme: How to use a different template on front page vs paginated pages?
- How to: Easily Move a WordPress Install from Development to Production?
- Is there a flowchart for WordPress loading sequence?
- How to change the default registration email ? (plugin and/or non-plugin)
- Essential technical features for high-end WordPress web hosting? [closed]
- How to remove admin menu pages inserted by plugins?
- Opinions and recommendations on the best barebones base theme [closed]
- How to put logs in WordPress