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

Getting Category Children

i have a problem understanding the get_terms function All i want is getting all the children of specific category so that it can be listed. But i don't really know how the $args works. So with this ...
0
votes
1answer
18 views

Getting custom post types to properly display alphabetically

I'm trying to get the sub loop of custom post types to display in alphabetical order, but having no luck. I've tried applying ksort and asort to the $posts array, but it just reorders the ID display ...
1
vote
1answer
31 views

How to get update_post_meta output to include string length

I'm using the plugin WP All Import to import a special post type. The plugin includes an action hook pmxi_gallery_image that runs after the import that saves the attachment images to the post gallery. ...
4
votes
1answer
86 views

How can merge two arrays values in one array and save in database

I am working on WordPress upload meta fields. When user upload images the images are sized in two dimension one is "thumb" and one is "big" and they re sized very perfectly. I save both of images ...
0
votes
1answer
24 views

Dynamically generated Navigation Diagram using Custom Fields

I am attempting to dynamically generate a Navigation Diagram (as seen at http://zinderlaw.indigo-grove.com) that uses custom fields on the page to fill in the href tags of the imagemap. I am not ...
0
votes
1answer
13 views

CPT and metabox: create multi checkbox by using array?

I have a custom post type to display informations of book. Then I created a metabox for it. And: I need to add a warning system (like: for kid, violent, mature, adult, etc...) chosen by multi ...
0
votes
0answers
25 views

How to find the function which is outputting Array

I'm calling a plugin (Event Rocket) from a template and the output is mostly as expected but seldom the only thing that is displayed is "Array". I have consulted the plugin's makers and they have no ...
-1
votes
0answers
10 views

How to show only first level menu and collapse lower level?

This allows me to create menu from pages I created. $html = wp_page_menu( array( 'child_of' => $id, 'show_home' => FALSE ) ); How can I modify the code to show show only first level pages and ...
0
votes
1answer
16 views

how to query for meta_value have array

I have array in post_meta like this: array( 'option1' => 'true', 'option2' => 'true', 'option3' => 'false', option4' => 'true', 'option5' => 'false' ) and I would ...
-1
votes
2answers
41 views

Insert data into custom table from fetching $_POST values

I get this type of data using print_r() Array ( [0] => test [1] => raviradadiya.ommune-buyer@gmail.com [2] => 1.00 [3] => 21:16:36 Jun 04, 2015 PDT [4] => 9DS7592P74GMN ) Now I ...
0
votes
0answers
24 views

Unique random characer generator [migrated]

PHP beginner here. Will the following code do what I've noted correctly? //Random code generator function random_string_func() { //Hash generator $generated_hash = md5(uniqid(rand())); ...
0
votes
1answer
21 views

Can't add classes using jQuery from a JSON string with get_body_class()

In order to refresh the classes on the <body>element after an AJAX call, I am writing at the top of my AJAX response the following in JSON: $o[ 'classes' ] = get_body_class('project'); I can ...
0
votes
0answers
41 views

Filtering with woocommerce data attributes

I'm working on woocommerce based booking system. I want to filter product by availability. Now I have custom data attributes for dates. It's submitting in wp_postmeta table. My date returning array ...
2
votes
1answer
89 views

How to store the_title() into a variable to reutrn the value, not just echo it

I have a loop, and need to pass one more argument through it. I need to get the current page's single post title, and then use that as the value. I tried going about it like this: $tagz = ...
0
votes
1answer
85 views

Query using string from custom field as array value

Firstly, what I am trying to do is display posts from Category x on posts from Category y where text from a custom field on post from Cat y matches text from one of 2 custom fields on cat x. I am ...
0
votes
1answer
34 views

Create Customization Controls from Array

Coming from a Javascript background and humbly jumping into WP dev I'm having some trouble with PHP (especially in a WordPress context). Here's what I'm trying to do: Create controls for the ...
0
votes
0answers
73 views

Loop through multidimensional array for values, then interest into mySQL table

I have a package of JSON that gives me something like this: [{"a":"5", "b":"9", "c":"3"}] I have a table with with three columns: a, b, c. I want to create entries into the table to match 'a', 'b', ...
2
votes
2answers
186 views

if is_singular array not working as expected

I'm using the following if statements within header.php to load custom tracking codes. <?php if ( is_singular( array( 'custom-post-type', 'post-name' ) ) ) : ?> // Specific tracking code ...
1
vote
1answer
34 views

Dropdown category filter

Ive an array set up to filter through various categories, currently it is only displaying 10 a maximum of ten posts instead of all of them. Where have i gone wrong? <div class="select-search"> ...
0
votes
3answers
40 views

How to decipher the following array

I created a custom key and wanted to store multiple values in the key with an array in my plugin using a drop down box, however, I printed out the array and came back out with this value... Array ( ...
0
votes
1answer
21 views

Creating a unique, linked list of tags from a specific category?

I am hoping to make a custom tag widget which displays all tags from a specific category. The code I am currently using is working correctly, but it is displaying duplicate tags. I would like to ...
0
votes
1answer
16 views

Pulling in Related Posts based on Post Type array

I'm trying to create a Related Posts section on my single.php file and I'm using this as a starting point (http://www.wpbeginner.com/wp-tutorials/how-to-display-related-posts-in-wordpress/) and my ...
0
votes
1answer
70 views

Get archives as array

I'm looking for a way to get the values returned from wp_get_archives as an array, similar to get_categories. I need to do this to modify the post counters to use - [#] instead of (#). See my current ...
-1
votes
1answer
22 views

trouble with passing class method data to outside function

I'm attempting to call a function using this shortcode format: [priceguide file='test.csv' type='mods'] When I do this, all I get back on the page is the file name, test.csv, and nothing else. ...
0
votes
0answers
38 views

Sort by a date field in a repeatable group

I'm using cmb2 WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress. I have a repeatable group for events with the meta_key 'date'. The repeatable group 'date' serialized array includes ...
0
votes
1answer
27 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
1answer
13 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
80 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
33 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
124 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
35 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
1answer
40 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
23 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
90 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
28 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
69 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
81 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
36 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
54 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
49 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
48 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
146 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
18 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
102 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
104 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
44 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
75 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
42 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
260 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
109 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' ...