Retrieving multisite blog IDs, somehow failing to foreach them properly
You’re setting $site_blog_ids to be an array of arrays. In that case, you’d want to do foreach ($site_blog_ids[0] as…
You’re setting $site_blog_ids to be an array of arrays. In that case, you’d want to do foreach ($site_blog_ids[0] as…
You’re making something completely wrong. Header comment In your main file, you need the following comment on top (ex. taken from Contact form 7): <?php /* Plugin Name: Contact Form 7 Plugin URI: http://contactform7.com/ Description: Just another contact form plugin. Simple but flexible. Author: Takayuki Miyoshi Author URI: http://ideasilo.wordpress.com/ Text Domain: wpcf7 Domain Path: /languages/ … Read more
Updating options via pure SQL is wrong. If you feel you have too many options to use the regular API you probably have too many options at all. A theme should not do the job a plugin can do. In fact, it should do as little as possible and let the user choose a plugin … Read more
You have a typo in orderby, and meta_value_num is only used as an orderby value, try this: $args = array( ‘post_type’ => ‘event’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘locations’, ‘field’ => ‘id’, ‘terms’ => $location // location term id ) ), ‘meta_key’ => ‘event_date’, // this meta field stores event date in yymmdd format … Read more
Do a tax-query and then count the result. No need for a custom query with dozens of JOINS. $posts = new WP_Query( array( ‘post_type’ => ‘MYPOSTTYPE’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘TAX_1’, ‘field’ => ‘slug’, ‘terms’ => array( ‘TERM_TAX_1’ ), ‘operator’ => ‘IN’ ), array( // etc. ) ), ‘post_status’ => ‘publish’ ); prinft( … Read more
As long as… You use $wpdb->prefix (or $wpdb->base_prefix) to prefix the table Your table name is someplace public, and easily available for other plugins, themes and end users to use and extend I would say either setting the table as a property on $wpdb or using a constant is fine. If you choose to use … Read more
You can do this one of two ways, as far as I can see: Use PHP to combine the current results to the one you want. Basically: $records = array(); foreach( $results as $result ) { $record_id = $result[‘item_id’]; if (empty($records[$record_id])) { $records[$record_id][‘item_id’] = $result[‘item_id’]; $records[$record_id][‘item_name’] = $result[‘item_name’]; $records[$record_id][‘sub_items’] = array(); } $records[$record_id][‘sub_items’][] = array( … Read more
you should check out the other posts related to this. A lot of times you will have some type of malware in WordPress coded in PHP which screws with your JS codes. I have seen other threads on stack about similar points.. JavaScript widgets do not move and no ajax edits. Check out this stack … Read more
1) Create a new page and assign a new page template to it, lets say site.com/update and update.php. Inside of update.php write you bulk mechanism: <?php // grab all your posts $parts = get_posts(array(‘post_type’ => ‘parts’, ‘numberposts’ => -1,)) // loop through every part foreach ( $parts as $part ) { // get part number … Read more
No, the column must exist before you insert data into it. Otherwise the query will fail. You should edit your table creation SQL query to accommodate the new column. Then, run it through dbDelta() again. dbDelta() will compare your query and the table structure and only create the missing columns. The best way to tell … Read more