The $post variable – Did I get the grasp of how the Backend actions get parsed?

As I’ve already wrote in question comments, at the very beginning of creating the new post or page first choose a template and save as draft. Meta box will appear after save if right template is used. <?php add_action( ‘add_meta_boxes’, ‘my_add_meta_box’ ); function my_add_meta_box() { // get template file name $template_basename = wp_basename( get_page_template() ); … Read more

No access to global variables?

To answer your question directly, yes, $wpdb is “auto loaded and set up to global by WordPress” but by loading wp-content/themes/roots/script.php directly you are skipping over the WordPress boot process and loading the file exactly as if WordPress did not exist. That is why the normal WordPress objects and constants aren’t available. They haven’t been … Read more

Is a multisite install what I need?

Yes, a multisite is what you need. The membership part is arguably a separate question, and there are many ways of doing it. I would suggest a dedicated members site users register to, but there are lots of other ways of doing it, and there is no definitive answer. See here for what to do … Read more

How to save a viewer specific option

Is there a standard interface in WordPress for saving a global PHP variable $bgcolor to the user and read it from him anytime he browses to another blog page. There is nothing that will automagically do it for you but it sounds like you just need to save a little bit of user meta, and … Read more

how do i register global query in template

Declare an array at the start of your layout, or in your functions file depending on the scope required and populate the array with all the bands using get_posts and making the key the post ID. You will then have a global array of bands, and can pull info from each one wherever you need … Read more

What’s the right way to share data between widgets?

Presumably, these are widgets that you are writing. If so, basic PHP class methods should do it– set a static class property to hold your “overlap” data. class Foo extends WP_Widget { static $overlap; /*constructs etc*/ function __construct($id = ‘twidg’, $descr=”Test Widget”, $opts = array()) { $widget_opts = array(); parent::__construct($id,$descr,$widget_opts); /*do stuff*/ } function widget() … Read more

Understanding WordPress Search

The default search is handled by WP_Query mostly by a method called parse_search(), which is triggered by the s parameter. You can search the source of WP_Query for is_search and piece together a few other bits and pieces. Or you can just create a query… $s = new WP_Query(array(‘s’ => ‘test’)); … dump the SQL… … Read more