An array (in PHP) is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array ...

learn more… | top users | synonyms

0
votes
2answers
504 views

Wordpress loop: Display <div> if posts exist

In a single post template I am trying to output some header text in a <div> and display links to related posts in a <ul> if related posts exist (based on tags). If there are no posts, ...
0
votes
2answers
501 views

Output from Meta Box Array

I have created a meta box and it's storing the post data successfully but I am having trouble outputting the content and displaying it in a sensible fashion - beyond my limited knowledge of PHP. I am ...
0
votes
1answer
679 views

How to save Wordpress Options as an array?

How do I save options as an array using forms? I don't want to use Settings API. Here's working form that saves 3 options separately: <form method="post" enctype="multipart/form-data" ...
1
vote
1answer
255 views

Arrays not working on a WP-Ecommerce product page

I am using WP-ecommerce to build a shop, and have a random product generator on the left and right sidebar. So the same product doesnt appear twice on the page, I have got the post id's from each ...
6
votes
6answers
2k views

Nice way to print_r arrays

So you know how Drupal has functions in modules like Devel that allow you to output arrays in a nice format like dsm($array) or krumo($array)... Does WordPress have an equivalent or a nice way of ...
-1
votes
1answer
444 views

Combine two foreach Arrays into one table row

right now I have two foreach arrays - one outputs the artist, the other a track title I would like to combine both so there is a row for each artist and corresponding track for example: Row 1 - ...
0
votes
1answer
697 views

Time & Date on Post - Time Ago Custom Function

I'm using the following custom function to display the timestamp for a post as posted "X minutes ago" or "X days ago" for 14 days and then this changes to the actual date (e.g. 17th December 2010): ...
0
votes
1answer
82 views

post custom values

I have this code: <?php $site= get_post_custom_values('projLink'); if($site[0] != ""){ ?> <p><a ...
1
vote
1answer
249 views

How to check an array of $curauth fields?

How do I check an array of $curauth user data? I need to check to see if one or more $curauth fields have data, and if so, print some html. This throws an array error: <?php if ( !empty( array ...
0
votes
1answer
122 views

Inefficient Query Confusion

Edit #3 - meta_keys as an array This seems to compare more than just the "opening_time" I can set the opening time for the wrong date or even leave it blank and it will still grab a post if the ...
0
votes
2answers
564 views

Echo 2 values from one key in Array with get_post_custom

Edit 12/15/2011 Added Radio Button print code // Add meta boxes to admin panel only needs to be added once add_action('admin_menu', 'plib_add_box'); //Add meta boxes to post types ...
0
votes
2answers
561 views

Echo custom field value in shortcode function

I must be doing something wrong here. I want to display the custom fields "pw_featured_note" & "pw_featured_price" Here is my code so far function featured() { ...
5
votes
2answers
301 views

Why does get_users suddenly return duplicates?

I'm having a hard time figuring this one out. I'm running a simple users query : $args = array( 'role' => 'custom_role', 'orderby' => 'ID', 'order' => 'DESC', 'number' => ...
0
votes
2answers
545 views

Get custom post fields from multiple metaboxes

I'm registering multiple metaboxes in my write posts panels. In functions.php: $meta_boxes[] = array( 'id' => 'products', 'title' => 'Products', 'pages' => array('post', 'page', ...
1
vote
1answer
520 views

How to store multiple values in 1 meta_key with radio input?

How do I store multiple values in one meta_key through a radio input and then display the two values on the page? One value would be a text string and the other would be a link that would go with ...
0
votes
2answers
2k views

Get list of all registered post types slugs

I'd like to get a list (array) of all the post types I registered. Precisely I would like to retrieve their slugs. Could someone help me? thanks!
0
votes
2answers
76 views

Obtaining values from objects

This code works fine and returns two StdClass Objects for each of my two posts: $children = get_pages($args); foreach ($children as $cake=>$element) { $args = array( ...
0
votes
1answer
197 views

Accessing value from associative array

Here's my code: $args = array( 'child_of' => $CurrentPage ); $children = get_pages( $args ); foreach ($children as $child) { foreach ...
0
votes
1answer
200 views

Accessing array elements (get_pages)

I'm trying to access the page ID of the child so that I can recursively call the get_children function on that child (to get grandchildren). if ($CurrentPage) { $args = array( ...
0
votes
1answer
581 views

Add 2 values to post__not_in

How can I add to values to the post__not_in function? For example, I want to exclude $value1 and $value2 from a loop Any ideas? Thanks in advance
0
votes
1answer
384 views

Use premade array as categories in wp_query?

I have a theme options panel that the user can set which categories they want to use which is then saved as an array $blog_cat[0] etc. They can select as many categories as they want for the array ...
0
votes
1answer
571 views

How to include post count in this “get_tags” snippet

Can anyone tell me how I can show a post count in this code snippet? <?php $tags = get_tags(); if ($tags) { foreach ($tags as $tag) { echo '<li><a href="' . get_tag_link( ...
1
vote
2answers
2k views

Working with query_posts ( arrays and query strings)

I'm trying to use the search query along with an array of arguments to narrow down search results, but I'm failing horribly. This is what I have so far. $paged = (get_query_var('paged')) ? ...
0
votes
1answer
119 views

Array: What is this value based on?

I need to do an import of an array of checkboxes, but there is a value that I don't how it is determined. The array is based on a user meta option that I created that shows a list of category ...
3
votes
2answers
513 views

How to set the default value of a option in a theme?

$shortname = "nuod"; array( "name" => "Custom Logo URL", "desc" => "Enter the link to your site's custom logo.", "id" => $shortname."_logo", "type" => "text", "std" => ...
0
votes
1answer
553 views

Wordpress Plugin Dev: Using array for WP options

I am busy dabbling with writing a WP plugin and hitting a bit of a problem. I believe its best practice to store wp options to an array rather than individually which is great no probs. I have two ...
1
vote
1answer
1k views

tax_query operator woes

I am trying to filter posts by multiple taxonomies. My code below works great, but their is one thing I can't quite figure out. When I filter the posts it seems that they only show the posts that ...
0
votes
2answers
1k views

Order by & include array by specific post ids

I have the following: <?php $num_cols = 2; // set the number of columns here $args = array( 'post_type' => 'testimonials', ...
0
votes
1answer
264 views

Categories Listing and Highlighting current category item

My query is on Wordpress and related to categories. I have a set of categories for my posts: All, Cat-a, Cat-b and Cat-c. a. When I click on the link to my posts page, I want to show an archive for ...
1
vote
1answer
1k views

Working with an Array inside Your Theme Options Array - Multiple Values

I apologize if this is covered extensively elsewhere, I'm not sure how to phrase my searches on the topic. Basically, instead of the following standard code to store data in WP-options... $options = ...
1
vote
2answers
424 views

Make Selected Mutiselect Items “selected”

I'm developing a theme settings panel for a new wordpress theme that have an option to exclude categories from being shown in the loop. I managed to get the main functionality to work, using a ...
1
vote
1answer
2k views

Is it possible to store arrays in a custom field?

If I understand correctly, custom fields work like this: key(string/int) => value(string/int) Is it possible to define a custom field like this? key(string/int) => value(array (string/int, ...
0
votes
1answer
607 views

how to limit and display tag?

Hi i need to show random 3 tags for a post. all my posts have been tagged with more than 10 tags, i need to display any 3 tags randomly. for eg: A sample post <a href="/tag1">Tag1</a> ...
1
vote
1answer
472 views

Stuck with a Custom Field Check box Array

Been stuck on this for a while now. Haven't come across anything that has shed any light on it for me... Pardon my ignorance... quite a newbie at this level of php. The problem: I am using the ...
-1
votes
1answer
84 views

How to create a cumulative posts and members count

I need to show my users cumulative posts and members registered count by date. It has to be displayed in an array format like this for posts array(array(2011,08,02), 500) array(array(2011,08,03), ...
0
votes
1answer
207 views

Querying multiple values from a single key

Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the same key the ...
0
votes
1answer
954 views

How to order a taxonomy's terms numerically, from lowest to highest using get_terms

I'm using get_terms to output a taxonomy's terms, which are all numbers: For example: 4, 6, 8, 10, 12 How can I order these numerically, so they appear exactly as above? What I'm getting is ...
0
votes
2answers
482 views

Comma seperated list of ID's as an array?

I have the following code that prints a comma separated list which I need in the form of an array, how do I get the list of id's into an array called $excluded_categories with contents as per below? ...
0
votes
2answers
288 views

WordPress & MySQL , problem with use many array in meta_query

I use this code for display custom posts : $args = array( 'category__in' => $bookcat, 'meta_query' => array( 'relation' => 'OR', array('key' => ...
1
vote
0answers
90 views

Unable to reorder the calendar using the WP Calendar plugin [closed]

This question is particular to the plugin "WP Calendar". The events are outputted in ascending order rather than descending which would make more sense since the newest should appear first. See the ...
0
votes
1answer
534 views

How to get a page array and category array going at the same time?

I'm using the code below to add a logo in the header of certain pages and I'm wodering if there a way to add the logo(sublogo.jpg) to certain categories as well as "page-one", "page-two" and so on? ...
0
votes
1answer
613 views

Decontruct serialized data array from wp_options

I'm trying to decontruct (and recreate) a serialized option value in wp_options called 'my_options' How would I build the array to recreate this option_value that currently exists for 'my_options'? ...
0
votes
2answers
141 views

Alter required message using comment form api

I prefer not to use asterisk markers on required fields in the comment form. So I'd like to remove or alter the 'required fields are marked (*)' message. Being a good wordpress user, I'd like to do ...
0
votes
1answer
438 views

search serialised meta_value for date value?

i've saved and array of 'open days' as a serialised array in a meta value. I was hoping i could then just search this field for the selected dates but i can't seem to create a match. serialised = ...
0
votes
2answers
822 views

Working with multiple values and metaboxes

I have multiple values I need to be able to punch into a meta-box on the post edit screen. EX: I am working with set-list information for concerts. Song 1 Song 2 Song 3 etc... I am always ...
1
vote
1answer
1k views

How to store post meta in an array?

What is the best way to store post meta in an array (using a custom write box, know how to do that) so that all post meta is in a single custom field?
1
vote
1answer
5k views

How to extract data from a post meta serialized array?

I found an XML to WP decoder script that stores the data as an array in a custom meta field. What is the best way to extract the information? For example how could I display the "Manufactured in" ...
2
votes
1answer
508 views

How do I properly format the user_role array?

I used a role editor recently and needed to delete a role. After deleting it I noticed that it began to appear as blank in the edit user role drop-down. After a bit of investigating and deleting ...
3
votes
2answers
3k views

What kind of object type is WP_Query?

I am getting this error when I try to return the post_title value from my WP_Query: **Fatal error:** Cannot use object of type WP_Query as array Here is the code: $query = new WP_Query( array( ...
2
votes
1answer
689 views

If function exists, and array is met, echo function?

I have a function like the following: <?php echo my_custom_function( array( 'category_url'=>'My Special Category' ) ); ?> It pulls data from the "My Special Category" and displays it. I ...