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
0answers
20 views

update user meta with multidimensional associative array

I am trying to: If a key exists If inner key exists Update value Else, Create key and populate with value Else, Create key and populate with value(inner array) ...
0
votes
1answer
38 views

How to get values from wordpress listings and use them in javascript array?

I'm trying to get values (latitude, longitude and an image) from the WordPress database and put it into a javascript array. Unfortunately I'm a newbie at Javascript and PHP! Here is the code I have ...
1
vote
2answers
199 views

Save custom post type in different table

I need to store custom post type post data into a custom table, not in wp_posts and wp_postmeta. Is it possible? anyone help please. Actually, I have created two custom post type named "truck" and ...
1
vote
2answers
26 views

Wordpress: How to use post_class() in an echo

I am working on a foreach loop in Wordpress and want to add 'post_class()' to a div within it. Currently the code looks like this: if ( is_array( $posts ) && !empty( $posts ) ) { echo ...
0
votes
1answer
27 views

Array to modify post titles

Could this be converted into an array: function manipulate_post_title($title){ global $post; if ($post->ID == 1) {$title = $title.'suffix';} if ($post->ID == 2) {$title = ...
0
votes
1answer
44 views

Repeatable field within repeatable group of fields

Compounding on Saving metabox repeatable fields ... I've created a metabox with a series of fields that are repeatable. However, within those fields, I'd like to create another field named Choices ...
-3
votes
1answer
19 views

Retrieve Array from within Array [closed]

I have an array being created within another array in Wordpress and I need to get the ID value from each Array. This is the code I am using to pull the array <?php $pages = get_field('products'); ...
0
votes
1answer
17 views

Echo only gives me the first part of string

So I was pulling some meta_value and trying to use it in a mass email and tested it first by echoing what I obtain in the array. In var_dump I see the array and that it gets my correct data, but when ...
1
vote
1answer
21 views

How pass a 0 in $atts?

I need to pass an attribute (tabindex="0") into my navigation link. I use this filter: /** * Add tabindex attribute to menu links * * Brings keyboard accessibility for opera browser. */ ...
0
votes
0answers
19 views

Wrap URL around custom field checkbox array

I have a custom field of checkboxes for choosing an "Area of Expertise" that was created using WCK (WordPress Creation Kit which I'm using to create CPTs and Custom Fields). I don't know if this is ...
0
votes
1answer
70 views

Multiple User-Meta Values in One User-Meta Key

Currently, I am adding user metadata with the key position_name and a string value representing a user's position, such that I can retrieve a user's position by way of a call similar to: $position = ...
0
votes
2answers
168 views

Create Array from custom post type to display a slider

I have created a custom post type in my wordpress theme dedicated to creating slides for a slider displayed on the homepage, It has a title, slide text and slide url and also featured image. I'm now ...
0
votes
0answers
12 views

get current taxonomy term to populate an array

I use this in a page template, I am hoping for a solution to filling in the 'XXXXX' space with the current term selected of the taxonomy 'place'. I don't think i can do_shortcode within an array. ...
0
votes
1answer
43 views

post__in works but also prints the word Array

First line of the code below carries post ids captured via a form. Then rest of the code helps pull the post-thumbnail of the respective post ids $sel_ids = $_SESSION['selected_ids']; if ( ! ...
1
vote
1answer
83 views

How can I get an array of all IDs from the current queried object?

I am trying to join an array of post IDs together. Right now, it seems my code is creating a separate array for each ID, instead of one array with each ID. This is the code that I have come up with. ...
0
votes
1answer
59 views

Get the values from an array string to work with post__in

Basically i need help to build a proper array to pass as value of post__in Basically code has to get featured images of posts only for selected ids. I need your help to extract the values of ...
0
votes
1answer
25 views

Get current user array into hyperlink

I am unsure how to take data from the user array and place some of these values into the following hyperlink. I want to replace the email address, first name and last name with the values from the ...
0
votes
2answers
34 views

Grouping posts by a custom meta value

I'm trying to output a list of dates that are held in a meta key called event_dates without duplicates. I've also tried a wp_query with a meta_compare but I'm not able to make that work either. Any ...
0
votes
1answer
111 views

ACF checkbox array is returning numbers, not labels [closed]

I am using Advanced Custom Fields and the add-on Repeater to create a field in the admin through which a user can select multiple icons. Each icon has an associated label, and I'm trying to return the ...
0
votes
0answers
51 views

WP Query posts__in not working with array

I am using the following code to generate a specific list of posts with WP_Query $args = array ( 'post__in' => $cookie_array, 'post_type' => 'tyre', 'post_status' => ...
0
votes
1answer
98 views

I need to exclude from a query a category and a few custom taxonomies

I need to exclude from a query a category and a few custom taxonomies. Is this code right? This query don't exclude any post, the one with the category, or the custom taxonomy. What am I doing wrong? ...
1
vote
0answers
78 views

How to save double quotes in post meta, when the post meta data is an array? [closed]

Ok so I've been scratching my head on this one for a while. I'm making a plugin that adds a custom meta box to a custom post type. I'm using the update_post_meta function to save the data from the ...
0
votes
1answer
22 views

Pulling posts tagged with similar title name

I'm trying to pull in posts in a page that are tagged with the same page title. For example, if the page is called Banana Pants, then I can call all associated posts manually like this: <?php ...
0
votes
1answer
113 views

Get current user array with post string

I need to get 10 current user fields and pass the field values to a post string. The post string is expecting certain label names for each value. Example - post string expects 'firstname' => ...
0
votes
1answer
51 views

Adapting a php array to WordPress

The guys over at the other Stackoverflow said I should post this here. I've been reading and tweaking code for three days and can't figure this out, because I'm new to php. The developer that wrote ...
1
vote
0answers
31 views

array of objects to do_action, callback gets singular object?

So I was passing an array of objects through an action today, no biggy, and things were working fine. Until I was iterating over one of the arguments to a callback and started getting errors. The only ...
0
votes
0answers
16 views

Parse error on user_register

I am trying to add a matching system. When I signup it will loop through all users that have the same interest as me, interests are done in checkboxes and put in one array. This is my whole function: ...
0
votes
1answer
67 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
69 views

wp_postmeta store multiple values in one key [closed]

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
15 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
166 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
65 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
40 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
175 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
62 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
131 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
39 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
140 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
70 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
63 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
28 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
75 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
43 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
42 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
43 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
82 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
243 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
270 views

Metabox repeating fields - 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
18 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
34 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 ...