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
1answer
18 views

display post tags on single.php inside loop

I want to display the tags of the current post in the single.php and do the following: <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1 class="single_h"><?php ...
-1
votes
1answer
18 views

wp_postmeta store multiple values in one key [on hold]

I am currently storing some data in a custom field like this: $get_ref = $_SERVER['HTTP_REFERER']; $ref = get_post_meta($post->ID, 'page_ref', true ); $ref[] = $get_ref; ...
0
votes
1answer
8 views

Category based on post id

I have the following: $custom_loop = new WP_Query( array('category_name'=>$category, 'meta_key'=>'name', 'orderby' => 'meta_value', 'order' => 'ASC', 'posts_per_page'=>'-1')); How ...
0
votes
0answers
29 views

how to get sub fields using advanced custom fields?

I am a compete beginner with Advanced Custom Fields. I would like to get your help in understanding acf well, most probably a simple question. I have a blog I use acf to categorize the posts. I use ...
0
votes
1answer
27 views

Widget checkbox array empty on update function

I have a widget that is not passing checkbox state to $new_instance, specifically $instance[ 'posts' ]; if I dump $new_instance in the update function it is empty? All the other instance variables are ...
1
vote
2answers
30 views

How to use IN array properly in Wordpress?

I have an array containting these values (including the apostrohpes): 'course_3202','course_3201','course_3200','course_3199' I try to fetch results from these values in postmeta-table. SELECT * ...
2
votes
2answers
77 views

Automatically adding meta data to posts or multiple query help

I run an events company whose website uses a custom post type system for posts (blog), events and tickets all stored as CPT's in the DB. On the guestlist (which counts 'ticket' custom posts if the ...
1
vote
3answers
31 views

get_*_meta doesn't always return an array

I find it annoying that functions like get_user_meta or get_post_meta will return an array if the meta key exists or false if it doesn't. This means I need to do a check like so: $meta = ...
0
votes
1answer
44 views

How to get specific string in explode array?

I have a shortcode where I'm trying to get a specific string from the $args array below. Query: <?php $args = array( //'post_type' => $posttype, 'post_type' => explode( ', ', $posttype ), ...
0
votes
1answer
32 views

How to avoid filling up an array each time I run a WP_query?

I am making a following user system and need some help for retrieving the users ids a user is following. At the moment I am using the following SQL query for retrieving the users ids a user is ...
-1
votes
1answer
46 views

posts_per_page - Repeats only first posts 'post__in' array

This question correlates with a previous question I was able to solve here: http://wordpress.stackexchange.com/a/137929/28389 I am using an array for 'post__in', and I am able to run this no problem. ...
0
votes
1answer
28 views

Removing a taxonomy term

There is a Wordpress function called wp_remove_object_terms that unfortunatly doesn't seem to work. I am trying to achieve the same ends using the following $post_terms = wp_get_object_terms( ...
0
votes
2answers
35 views

post__in - Placing content from a foreach loop inside of an array

I know this code is incorrect, but it's a basis of what I am trying to achieve. I am parsing an xml feed via PHP and running a foreach loop to get a value from a specific key. Here is the snippet I ...
-1
votes
1answer
18 views

Populate Array with values from another arrray [closed]

I have retrieved WP_Post object and i stored it in a variable. Array ( [0] => WP_Post Object ( [ID] => 45 [post_author] => 1 [post_date] => 2014-03-10 14:22:01 ...
0
votes
0answers
36 views

Sort taxonomies in select dropdown with topmost parents as optgroups

I have an array of objects with custom taxonomy terms. This taxonomy represents a list of countries/states/cities which are being used by a certain post type and other parameters (I'm not using a ...
0
votes
1answer
28 views

Minimize database queries to user tables?

I'm trying to come up with a strategic way to collect large amounts of usermeta data (and output to the screen) while keeping database queries low. Some pages, like the home page, single pages, and ...
0
votes
0answers
25 views

Get taxonomies inbetween WP_Query?

Basically I have two loops that work seperately but I need information of one of the loops to go into a listing which happens to be in the other loop. This concerns fetching custom taxonomies and ...
0
votes
0answers
31 views

Working with arrays/foreach statements - echo results? Addition operator w/foreach… multiplying?

I'm really struggling with this - I'm relatively new to PHP but I'm trying make this code that I've pulled together output a list of chapters sorted by user pageviews based on a user_meta field called ...
0
votes
0answers
27 views

How to output data from meta box with cloned fields?

Just to let you know, i am at a beginner level with PHP, so please bear with me : ) Also, I looked at this post and I did not find it helpful in my case, so I am making a stab at it here. (Meta Box ...
0
votes
1answer
71 views

Update value of a associative array with update_post_meta

I am trying to change the value of a specific key of an associative array which was saved in my post meta. This is how my array is saved in a custom field: Array ( [0] => Array ( ...
0
votes
1answer
78 views

Metabox radio buttons not saving correctly

I have multiple radio buttons set up inside of a metabox in a custom post type. I have created the metabox like so: add_action('admin_init', 'add_meta_boxes', 1); function add_meta_boxes() { ...
0
votes
0answers
8 views

meta_query works with single query but not multiple queries

This is very strange and I'm not sure why it is happening but this piece of code... $args = array( 'post_type' => 'property', 'sentance' => true, 'meta_query' => ...
0
votes
0answers
18 views

Sort Post by Author Meta Field?

Im trying to make a High Scores table. The scores are stored in the user profile as an author_meta. Im not having any problems getting the scores from the post, what I cant do is put them into an ...
0
votes
0answers
44 views

Multiple file inputs in array in theme options

Trying to add multiple file inputs to theme option settings. I'm having trouble with wp_handle_upload it's giving me this error array(1) { ["error"]=> array(1) { ["img"]=> int(0) ...
0
votes
1answer
26 views

Array in meta key?

I have a custom post type called "conference". I want to create a specific meta key for users who have registered for the conference. For example the meta key slug would be registered_users which ...
0
votes
1answer
45 views

Tax query array terms display out of order

I want my tax_query terms to display posts in the order I have them listed in the array below but it is not following the order listed. $args = array( 'post_type' => 'staff', ...
0
votes
0answers
22 views

File input returns null in theme options array

Trying to work out a rather complex array situation with a theme options page. While working with file upload I can't seem to get it to work. Any idea what I might be missing? Simplified example ...
0
votes
2answers
50 views

Order posts with custom taxonomy array

I am trying to make my loop go through the posts that are associated with these terms. Currently nothing is being output. <?php $args = array( 'post_type' => 'staff', ...
0
votes
0answers
16 views

How to put a select option in jigoshop checkout?

Am I doing the right thing guys? Please help me. What I want to happen is to put a shipping time in billing address. Help me please. Thanks array( 'type' => ...
0
votes
1answer
28 views

How do I create a numbered list with PHP? [closed]

I'm having some difficulty functioning this morning! This isn't specifically WP (more PHP), but I think that it would benefit WP devs in the future, so I'm asking here. I'm trying to create a list ...
0
votes
1answer
21 views

Can't print out returned value

Function to return the meta value as per author. <?php function ac_author_score() { $userID = get_the_author_meta( 'ID' ); $query = array ( 'author' => $userID, ...
0
votes
0answers
53 views

How to get duplicate array count with custom post type

After printing array I am getting output like this: Array ( [0] => WP_Post Object ( [ID] => 8 [post_author] => 1 [post_date] => 2014-01-31 ...
0
votes
0answers
27 views

Wrong datatype for second argument error

I am getting a strange error on my Wordpress site. Does anybody know what is going on here? and how to fix this? The Error: Warning: in_array() [function.in-array]: Wrong datatype for second ...
0
votes
1answer
39 views

Get posts by list of post IDs ordered by those IDs?

I am going to make a "favourite" posts box, but the article id's are stored in another DB so I only get an array of IDs (which are relevant to the WP DB). I think it could be done with get_posts() or ...
0
votes
1answer
25 views

wpdb select from using array as search parameters

Similar to how you can insert into an array using code such as $wpdb->insert( $table_name, $inputs); //where inputs is an array I want to do a sql select statement with code such as ...
0
votes
1answer
49 views

Does meta_value (array) work with 'orderby'?

My goal here is to query posts by a meta_key, with the values falling in between 1-100. When pulled, it is suppose to be ordered by ascending starting from 1 to 100. $post = array( ...
0
votes
0answers
36 views

Adding line to multidimensional array option

I'm building a shipping plugin with a settings page where the user can add boxes with the attributes : Name, Length, Width, Height So far, I have managed to greate an option boxdata[l,w,h] and I have ...
0
votes
2answers
45 views

Create menu locations for each category in wordpress

I need display a special menu in each category page in wordpress, for example I have 3 category: horse,dog,cat So I must have 3 menu in Menu Settings locations with name: horse,dog,cat with this ...
0
votes
0answers
31 views

tax_query operator issue. IN works, AND never returns any results

This is a bit complicated. I have a wp_query that is almost working perfectly, but I have one issue. I think there is something here that I'm just not seeing. All of my code is an included php file ...
0
votes
1answer
39 views

Extract array from custom field

I'm using woocommerce product bundles extension. I need to manipulate some informations about bundled post. Actually I found the bundled product container has a hidden custom field named _bundled_ids ...
0
votes
0answers
38 views

Using Advanced Custom Fields with Associative Arrays

So, I've got this conversion chart I'm working with, and have stored its values in a simple array, wherein it lists both UK and US sizes: $conversion = array( "2.5" => "1", "2.75" => ...
0
votes
1answer
108 views

Multiple entries in get_option results? or why is _multiwidget set to 1?

I am developing a wordpress widget, and need to store some user configuration values, that is why I am using wordpress update_option and get_option. I am new to widget development. I have some ...
0
votes
0answers
20 views

Would like to be able to take list of pages, and place them into an array

Well...title says it, but here are the details. I would like to take a list of all of the active wordpress pages on my site, and place them into a list. This list is generated by an array (it uses ...
0
votes
1answer
104 views

return paginate_comments_links() as array

The documentation specifies: type (string) (optional) Controls format of the returned value. Possible values are: 'plain' - A string with the links separated by a newline ...
0
votes
0answers
47 views

Pull Data from DB for Admin Page Display as Relates to Admin Page Class by BA Internet

Why do developers make it so darn hard to use the tools they develop? Don't answer, I already know :) Have had some success using this: https://github.com/bainternet/Admin-Page-Class ...to develop a ...
0
votes
1answer
40 views

Widget : html 2 dimensional array doesn't work

I have some strange trouble with my WordPress today : I want to store same multiple values in a widget, so I create something like this : myCollection[id][myField] as input's name for my admin widget ...
0
votes
1answer
38 views

Custom Post Type Author Array Problem

I am trying to create an author.php page that calls custom post types by the author appearing on that page. My problem is that when using the code below -- which filters for the post type 'video' -- ...
0
votes
0answers
29 views

How can I call menu_class into this PHP script?

For mobile navigation I would love to call menu_class and drop it in below "foreach ( (array)". Ideas? Everything I've tried won't work. New to PHP, thanks / cheers :) <?php ...
0
votes
1answer
30 views

How to make sure relative URL works when site is not on root domain?

I just tried installing my theme on another WP install that lies in a subdirectory of the domain. I never really thought too hard about subdirectories, but it does happen so I know I need to change ...
0
votes
1answer
55 views

Sort Posts with custom meta key by default which is currently set as optional

I'm new to Wordpress so please bear with me. Please check this link The posts are currently sorted by date. But if you mouse over on Latest Articles you see there are other options for sorting like ...