Moving variables from one page to another

you could POST the shop id to the target page. otherwise- cookie, session. or just fetch it on the list page via ajax. edit – a simple post request via a form: in your source page: <form action=”b.php” method=”post”> <input type=”hidden” name=”id” value=”42″ /> <input type=”submit” /> </form> in the target page b.php: <?php if( … Read more

How to pass data around?

I have different menu items. When the user clicks on a menu item, I want them to go to a particular destination. Each menu’s destination has a different background color. When you say destination I assume you mean page or post. If you use WordPress’s built in body class and post class you can target … Read more

Using Multiple Queries of “home_url” vs. Calling a Variable Multiple Times

If you look at the source for the home_url() function, you’ll note a small series of function calls eventually invoking get_option(). As explained in this WPSE Answer, the get_option() function is cached, meaning that if an option’s value is already in memory, get_option() returns that value instead of querying the database again. As a result, … Read more

Print string to footer using wp_footer option

Do you have to use a variable for you script? I have done this in the past and has worked… // add script to the footer and break out of PHP function slider_option(){ ?> <script>script function data</script> <?php } ?> add_action(‘wp_footer’,’slider_option’); If this does not work make sure you have the footer hook in you … Read more

Passing attributes to shortcode dynamically

Not quite like that, but you can achieve the same result if you use a pre-defined value or argument in your shortcode to act as a “flag”: [authoorsposts author=”post”] …then in your handler: function wpse_209684_author( $atts ) { if ( ! empty( $atts[‘author’] ) ) { $author = $atts[‘author’]; if ( $author === ‘post’ ) … Read more