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
17 views

The writing ( with foreach) of the keys of an array of objects to a new array produces fatal error

I have the following problem, i've queried the attached media to a post with: function abc_attachments( $post_id ) { $query = array( 'post_parent' => $post_id, ...
0
votes
0answers
11 views

Query from metadata where meta_value is array [on hold]

I want to create a MySQL select function where I need to check if a value is in an array. I Googled and found that I should use the IN function but I don't know how to construct it. So here is the ...
0
votes
1answer
9 views

Hide sidebar if post_type is in array

I would like to hide the sidebar on certain post types. I can hide it on one post type by using: if ('example' != get_post_type()) { How could I use the above with an array? $hide_sidebar = ...
0
votes
0answers
29 views

Auto remove empty values in array

I have a custom meta box that let's users add new fields. If the fields are saved the values are stored in an array. If a user wants to delete a certain value he empties the field and saves the page ...
0
votes
0answers
19 views

Trying to add $_POST Array to update_post_meta doesn't populate

This is the code that is sending the info: $postdata = array( 'show_id' => '11', 'show_start' => '2015-03-17 11:00am', 'line_items' => array( '1' => array( ...
0
votes
1answer
36 views

Save meta box values as an array to wp_postmeta

I have a custom metabox running that dynamically adds fields to the form I'm stuck on the saving part. This is how the fields are added: <tr> <td valign="top"> <label ...
0
votes
0answers
33 views

When using an options array the Settings API isn't creating the database record

At the moment i am building my first plugin. So far i've saved as well as successfully uninstalled the options with single db records; everything worked like a charm. At the moment i try to improve ...
0
votes
0answers
3 views

Converting Mutidimensional array into json format [migrated]

I have result array from database like this Array ( [0] => Array ( [days] => October, 2014 [ispaid] => 1 [total] => 1683 [sales] => 3 ) [1] => Array ( [days] => September, 2014 [ispaid] => 1 [total] ...
0
votes
0answers
12 views

Need help displaying array content programmatically [migrated]

I have an associative array that contains key pairs for the titles of a jQuery navigation list that is working for the portion of the code. See left side of the picture below: The problem is on ...
0
votes
1answer
25 views

Non-array argument in array_merge()-function [closed]

I'm building a small plugin, basically with a settings page that holds four text fields and two checkboxes. Everything works fine, including the checkboxes - as long as one or both of them are ticked ...
0
votes
1answer
17 views

Trying to get property of non-object in shortocde

I'm having error in shortcode that "Trying to get property of non-object" on line no 130 Here is code: while ( $our_work->have_posts() ) { $our_work->the_post(); $termsArray = ...
0
votes
1answer
38 views

Can A Post Meta Field Store multiple values that are not in an array?

I have a post_meta field that seems to be displaying multiple values, yet they do not seem to be in an array. Using debug bar, this is what I see inside of the ...
0
votes
1answer
16 views

Exclude Tags by Array

and thanks for any help!. I'm trying to display all of the tags except ones that start with a token ("Author: "). I have figured out how to exclude a single tag (just typed it into the exclude ...
2
votes
1answer
48 views

get_option function

I'm currently trying to make my own theme, but i'm not quite sure how the get_option() function works, because how come this.. echo get_option('show_header', 'sultenhest_theme_display_options'); echo ...
1
vote
0answers
41 views

Sort alphabetically by custom field

I'm trying to change the sort order of a custom field in a custom post type. I want it to be be alphabetical by the 'location' name. It's sorting by location, but not keeping them in alphabetical ...
0
votes
0answers
30 views

wp_query - Modify $query to include duplicate content

I'm setting some featured content through the customizer (it's saved in theme_mod); Using the pre_get_posts hook, I'm retireving the feature pages in this way: ...
1
vote
1answer
35 views

Problem:Save Several Duplicate posts in The Database and then Error nesting level of '100' reached

I have a function to insert a single post in the database. But when I run the function, duplicate posts (40) are added to the database and then an error is displayed. Fatal error: Maximum ...
0
votes
0answers
35 views

Trying to uswp_localize_script with Advance Custom Fields Repeater

I have an external javascript file that I am trying to change dynamically: Here is the Javascript that I want to be dynamic slides : [ {image : ...
0
votes
0answers
37 views

Proper Array Setup

I'm having real trouble getting this to function right, basically I'm tweaking an array for the related products section of WooCommerce for WP, but it's not really a plugin issue more of a general ...
0
votes
1answer
48 views

getting attachement images src and add classes

I have posts whose each contains 4 attached images. what i'm trying to do in my single.php is to get all the 4 images src to be abble to add different classes to each images. <img class="image_1 ...
0
votes
2answers
14 views

Only load certain artists on this page

I have a wordpress page which loads all the artists in two columns... here is what I believe to be the relevant bit of code <?php global $paged; if ( is_front_page() ) { ...
0
votes
0answers
87 views

Query Posts with meta_query key in array

I am trying to query posts using meta_query to get a series of dates stored as an array in the key repeat_intervals. I am able to query the first date using the following: global $post; query_posts( ...
0
votes
1answer
43 views

Create dropdown menu of all tags used in category

I'm attempting to create a tag-based filter on a category page, so I only want to show those tags that are used by posts in that category. I've got it mostly working, but the list isn't coming out ...
0
votes
1answer
32 views

Iterate through ID's in loop

I have created a custom loop based on category, now I would like to run a function with the specific ID of the current post being iterated through as a parameter. I have.. $secondary_loop = new ...
0
votes
1answer
32 views

How do I use foreach to get content from a custom-field in multiple posts?

so I am trying to use a foreach to pull content from a custom field in multiple posts, but it just wont work. I can get it to work for a simple textarea string but I am struggling getting it to work ...
0
votes
1answer
28 views

How to get several fields from wp_query?

I'm going to get several fields from wp_query result. I know about wp_list_pluck() function, but it accepts only one field paramether. How to get several ones if I'd like to take several parameters ...
0
votes
2answers
115 views

WP_insert_term how to insert multiple values as taxonomny term?

I have this script (found online) to import the values of an input form field as a taxonomy term. I got it working, but now I'd like to import/save the values of multiple form fields. Now all it does ...
1
vote
1answer
55 views

Only showing the_date and the_excerpt for first entry in get_posts

this code below shows the titles and links for 5 posts in get_posts no problem but only displays the date and excerpt for first post... any help please? <?php $args = array( 'posts_per_page' ...
0
votes
1answer
121 views

add the value of a variable returned in a while loop [closed]

I am trying to add the values of a variable together and display the total value. I am using posts to posts to create a connection between my custom post types 'recipes' and 'ingredients'. the ...
0
votes
0answers
53 views

Fetching array of postmeta with $wpdb and in_array conditional

I'm trying to fetch an array of all entries to a specific meta key and then check to see if the user input value exists in that array. I've checked the data base for the query and I see the meta ...
0
votes
1answer
57 views

Exclude specific user_id from args in get_comments

I'm basically using a 'latest comments' system on multiple pages where one specific user is listed as the first reply for a comment - highlighted with special CSS - and then 2-3 normal users below ...
0
votes
1answer
25 views

Problem displaying replies as part of author's latest comments on author page

I've based a lot of my method on this thread here I can currently display 5 latest comments on an author template page. I want to display the latest 3 replies from any user for each 'main' comment ...
0
votes
0answers
67 views

How to sort a WP_Query array by post_name after an array_merge();

I have an WP_Query array made up from two WP_Query() objects merged together as follows: $query1 = new WP_Query($args1); $query2 = new WP_Query($args2); $wp_query = new WP_Query(); ...
0
votes
0answers
16 views

wp_delete_attachment() issue

Short background: Users can contribute to a certain project by sending in submissions. They can send up to five files for each submission. The images ID created by WordPress is stored in a custom ...
0
votes
1answer
75 views

post_parent array doesn't work

I have a problem. I created a shortcode to show a galerie. I used query_posts to fetch all posts of a parent post and get the data from there: function galerie_baureihe() { $parent_id = ...
0
votes
0answers
60 views

Storing PHP structure data in the wp_options table?

I searched too much about that but can't find resonable answer of that question I am creating a WordPress plugin that has so many options that I need to store so to store data using option API which ...
0
votes
1answer
14 views

Render shortcodes with get_post_custom

Wondering if anyone knows how to get a toggle shortcode to render when using: get_post_custom <?php $post_customs = get_post_custom(); //$post_customs = the_sub_field('project_items'); ...
0
votes
0answers
90 views

get_post_meta() cannot return values from nested arrays

I apologize if this question was answered on here. I searched and could not find an answer that related to my own issue. I've been turning my wheels on this for three days now and am now seeking ...
0
votes
1answer
50 views

Exclude Post ID from Array Specified in Custom Field

I have a custom field 'exclude' and the value would be a particular post, let's say 2124. Within the array I want to then call this custom field for the exclude => field but is this even possible?
0
votes
0answers
52 views

Display a post based on its metabox selection

I created a client portal where a client can view their projects. I have two user accounts "Clients" and "Administrator. Both clients and administrator are redirected to the frontend of the site to a ...
0
votes
1answer
43 views

Issue with WP_Query (need a array of selected ID's)

Today I have <?php $loop = new WP_Query( array( 'post_type' => 'inspirations', 'posts_per_page' => 50 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> ...
0
votes
1answer
124 views

Retrieve featured image as object

I want to retrieve the featured image of a post as an object (array) in order to have all image sizes available. The get_the_post_thumbnail() function doesn't do this, any ideas?
0
votes
1answer
63 views

Multiple meta query from array

I need to do multiple meta query from my array. I have something like this: $search_term[] = array( 'key' => '_cmb_listing_status', 'value' => 'Active', 'compare' => '=' ); foreach ( ...
0
votes
0answers
36 views

$wpdb->get_results in not an array

Using get_result I receive an "Invalid argument supplied for foreach()" because is not an array. I tried with get_col but I don't know how to extract the data and I don't know the difference between ...
1
vote
1answer
49 views

Return array keys and values

I am creating some options in the functions.php file. I created a function that gets input on the front end, puts the values into a new array and returns them to the front end. I am trying to figure ...
0
votes
1answer
26 views

meaning of (array)function()

I saw this piece of code that have part of the code I never saw before. What is the behavior of (array) in this scenario? so far I know the way of creating arrays in php never see this. // ...
0
votes
1answer
48 views

WordPress custom field images not getting inserted into array

I am using Wordpress to create a dynamic gallery using Bootstrap. I created a new custom field and then set it to 'images' and then assigned it to my post type. It then shows up in my post, I uploaded ...
0
votes
2answers
39 views

How can I get a list of custom post IDs into a variable I can use for another function?

How can I get the same output into a variable that I can then use in another function? //get all the post ids of current projects $qry_args = array( 'post_status' => 'publish', // optional ...
0
votes
1answer
65 views

Get latest post from categories

I have 3 categories: Travel, Destination and Tips. I've been trying to get the latest post from each categories then put them into an array. Here's what I have in mind. //GET CATEGORIES //I have this ...
2
votes
2answers
319 views

WP_User_Query order by meta_key that is an array

I have set a user metadata named achievements which is an array containing various numeric values. Using WP_User_Query, I want to order the list by a specific key within this array named points. The ...