Using variable in two functions

As a matter of good coding practice, global variables are problematic at best, dangerous at worst. They should be avoided if at all possible. Why? Because what if some other plugin developer also decides to define$a as a global? Whatever that plugin is doing will now overwrite your global $a and yours has the potential … Read more

Passing variables to new page

Edit: OK, I get what you’re trying to do a little better. This should help get you there. Cache the data that you are going to want. You’ll go over your API limit quickly if you query Yelp on every page load – not to mention slowing your site down terribly. function yelplist() { $pizza_joints … Read more

How Can I Access a PHP Variable in Another PHP Function

G’day mate 😉 I’ve done this by outputting the variables within a script tag right within the body. I played around with your code and came up with this solution: function lax_google_map_init() { // Don’t bother loading the scripts if we’re in the admin area if ( is_admin() ) { return; } wp_enqueue_script( ‘google-maps’, ‘http://maps.googleapis.com/maps/api/js?sensor=false’ … Read more

Why does WordPress Pagination Remove the Spaces from my GET Variable?

Not sure exactly how you’re adding “find” to the list of query variables, but this is the method you’re supposed to use: function wpa_20565_query_vars( $public_vars ) { $public_vars[] = ‘find’; return $public_vars; } add_filter( ‘query_vars’, ‘wpa_20565_query_vars’ ); I use that to add custom pagination for my custom post types and custom filters for various other … Read more