I'm using the following code to pass variables through the URL, in wordpress.
if (isset($_GET['layout'])) {
$layout = $_GET['layout'];
} else {
$layout = '1';
}
With $layout
I retrieve the value in the code, where I use to change the layout style.
Calling this url works fine. localhost / wp /? layout = 2
In this url there are several links to other posts, pages, categories, etc. I would like that when calling a variable in the URL, it would apply to all links on that page.
For example:
I start by calling the variable layout
in the url
so: localhost / wp /? layout = 2
And on this page you will have a link to the "about" page: so: localhost / wp / about
I wanted the layout
variable to be automatically placed on it and all other links.
In this way: localhost / wp / about /? layout = 2 , localhost / wp / other-page /? layout = 2 , localhost / wp / category / technology /? layout = 2