how to store wordpress loop in array?

Use get_posts instead – You can use the function get_posts() to get all the posts as array. This function accepts almost all parameters that of query post’s. Example – $args = array( ‘numberposts’ => 3,’category’ => 3 ); $homePost = get_posts( $args ); $one = $homePost[0]; $two = $homePost[1]; $three = $homePost[2]; //print_r($one); // lets … Read more

Get user_meta values for a user for an array of meta_keys?

get_user_meta() with omitted key argument will return all data for the object. Trying to retrieve metadata selectively is usually pointless optimization from performance point of view, since everything built on Metadata API tends to just query all data anyway and cache it (which in turn object cache plugin makes persistent and snappy).

Create menu locations for each category in wordpress

You’re going about this wrongly, I think. The theme_location parameter for wp_nav_menu() is a template location – i.e. a physical location in the template, as defined/registered by the Theme. It’s not designed for an arbitrary number of locations based on arbitrary user content. If you want to output category-specific menus in specific template locations, you … Read more

meaning of (array)function()

You are looking at type casting: http://php.net/manual/en/language.types.type-juggling.php What the code does is caste the value returned by get_option() to an array. It is being done so that array_merge() works correctly and doesn’t trigger warnings/errors. That much is pure PHP and is off-topic. The only reason I chose to answer rather than to post a comment … Read more

post_parent array doesn’t work

It’s not recommended to use query_posts(), check for example this warning note in the Codex: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)