The cookie is stored on the user’s computer. The page is generated on the server. Somehow, you must make sure the cookie is transported back to the server when the user clicks on a link to fetch a second page.
The instrument for this is javascript. You must send a script with the page that reads the cookie and adds the cookie content as a query_var
to any internal link, so when it is clicked the query_var
is sent to the server.
-
Make the script to read the cookie. I trust you have already done
this. -
In your theme, make sure all internal links have a class
that you can use to trigger a script that will in turn trigger the
cookie script and add thequery_var
to the url.
I realise this answer is incomplete in terms of code, but I hope you get the idea.
Related Posts:
- How to override functions.php in child theme?
- Overriding core functions in child theme
- Change parent theme file function in child themes functions.php
- Overwrite Parent Theme add_image_size in Child Theme
- Language switcher for subdomains
- Load a Child Theme’s style.css just before the closing tag
- Why functions metaboxes is causing White Screen in Admin [closed]
- Setcookie not setting cookies anywhere except admin
- get_template_directory_uri pointing to parent theme not child theme
- Why isn’t is_page working when I put it in the functions.php file?
- Get the ID of the page a menu item links to?
- Disable visual editor on one specific page
- TinyMCE custom styles remove class when switching styles
- One Child Functions.php for Multiple Child Themes
- Extending auth_cookie_expiration based on user role
- Removing custom background and header feature in child theme
- How to override function in functions.php of parent theme?
- override parent theme configuration in child functions.php
- Show/hide Widgets in Dashboard Based on Current Advanced Custom Fields Option
- syntax for remove_filter in parent theme with class
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- How to display error messages using WP_Error class?
- Slugs as breadcrumbs for Pages
- Function in Child Theme not overriding Parent Theme function [duplicate]
- Add inline css to theme
- Pages should have priority when using add_rewrite_rule
- Setting cookies in WordPress
- Programmatically set page template based on page ID
- Add external js file to footer with id
- Child theme functions.php not executing
- How to add background image control to page admin controls?
- Make “sidebar template” the default template for new pages
- override parent theme configuration in child functions.php
- wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go
- How to use thumbnails in gallery?
- Logic to Print/echo a css class only for 1st post and ignore all post after 1st? [closed]
- wp_insert_posts keeps adding multiple pages
- Best practice when altering a parent theme function inside a child theme?
- How to include local menu based on page id?
- Can’t load WP function into external function
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Creating a child theme – functions.php code issue
- is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript
- Overwriting Parent Theme’s Image Sizes
- Override a theme function in a child theme?
- Display post shortcode content in the sidebar?
- Twentyten Child Theme: header images display messed up in admin panel
- how can I edit flexslider in woocommerce. [Urgent]
- Please Explain the Importing Process of Multiple Stylesheets for Child Themes
- Populate editor with some content of a page with a page template
- Jquery implementation not working on page reload
- Reuse variable in hook callback
- Usage of theme name in functions
- How to load parent theme template parts in child theme
- ACF not showing
- Running script based on Category
- Check if the image size is available and if not use ‘full’ image size
- Can we create our own theme’s function.php?
- Not all CSS elements transferring via parent to child?
- Define PHP variable from a seperate API if statement
- Does size of a theme’s functions.php file matter?
- get_next_posts_link() returns no result despite available posts
- Randomizing wp_tag_cloud() in child theme
- Nav menus all outputting the same links
- Where do I go to edit this area? [closed]
- How to insert class in each list of categories?
- Parent theme styles overriding child theme CSS [closed]
- I can’t add CSS with functions.php
- Combine two active_callbacks into one on theme customizer
- How to overwrite template.php file
- remove_action not working, even after changing priority [duplicate]
- Is this an acceptable practice for WordPress theme development?
- How to use parent theme functions in child theme functions.php file?
- Removing parent theme CSS without editing parent theme
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- get content from page through AJAX
- Need advice on theme customizer and child themes
- Change custom featured image size in twentythirteen child theme
- How to assign php file(template) to several pages with same prefix page name/slug
- Include widget file in functions.php of child theme
- how can I add filter in specfic field in my website?
- How to fix Function create_function() is deprecated in / themes
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- How to customize archive widget only for cpt?
- wp_title() return random number
- How to add javascript code into Divi child theme?
- How to offset main query without affecting other queries and backend
- Remove the delete link from pages without a plugin
- HowTo: Add wrapper to columns shortcode?
- How to create admin ajax function for my contact form
- uninstall a theme programmaticlly
- How to disable site title and description when custom header is uploaded on the customizer?
- Update add_image_size
- Custom field not updating via functions upon publishing
- Using array page name together with page id to deregister script
- Standard Way To Do Custom Work Within A Page?
- Add the title of a widget as an ID – for anchor links
- Child Theme not working – CSS gone
- How to fix enqueue_styles error for a twenty-seventeen childtheme
- post_row_actions filter from parent theme not executing in child theme