0
votes
0answers
35 views

Ajax doesn't work on second call

I'm using Ajax to load posts into a sidebar that are filtered by a chosen category. It works perfectly fine the first time, but for some reason the second time it loads a mixture of results from the ...
0
votes
1answer
52 views

Php file that doesn't recognize wordpress functions

I have a custom contact form that I am trying to process in other file: The form: <form method="post" action="<?php echo get_template_directory_uri() . '/templates/contact.php' ?>" ...
0
votes
0answers
64 views

Wordpress $GLOBALS and PHP $GLOBALS

Is the php $GLOBALS associative array over written in WordPress with the WordPress $GLOBALS? I have a piece of code that uses $GLOBALS['myvariablename'] to access a global variable. It works in php, ...
0
votes
1answer
61 views

key( $GLOBALS['wp_registered_sidebars'] ) is always showing the same value

I am using this code from another answer add_action( 'dynamic_sidebar', 'wpse_96681_hr' ); function wpse_96681_hr( $widget ) { static $counter = 0; // right sidebar in Twenty Ten. Adjust ...
2
votes
3answers
14k views

How to set and use global variables? Or why not to use them at all

UPDATE: My original question has been solved, but this is turning into a valid discussion about why not to use global variables, so I am updating the question to reflect that. The solution was ...
0
votes
1answer
230 views

Where is this function's callback getting its arguments from?

This might be better suited to Stack Overflow, thought I'd try here first though. I was walking through this tutorial by Justin Tadlock and encountered the function below being used as the callback ...
4
votes
4answers
2k views

Where to get information about array fields in $_REQUEST?

I just started to learn PHP and doing things with WordPress and I am a bit confused about information in Codex. Was told that Codex got all info I required but I got stuck with it. What array fields ...
0
votes
1answer
2k views

How to call a function only once (global variable scope)

I have been trying to work out the most effecient way to use functions in WordPress. I have a big slow function big_slow_function() that ideally is only run once. But I need to use the boolean that ...
4
votes
2answers
2k views

Does an activated plugin automatically mean its methods are available to other WP functions?

I made a WordPress plugin like this: Class MY_CLASS { //codes } Global $myclass; $myclass = New MY_CLASS (); After installed and activated the plugin, can I use this class in other plugins without ...
1
vote
2answers
760 views

Call External Object in Class Function During Callback

I've a class which has a function that check and creates table in database. In order to do so i need to use WordPress $wpdb object. I need the function to run only on first plugin activation, so i ...