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

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 ...
-3
votes
0answers
13 views

How to create a drop down field in custom theme option menu? [on hold]

I am making a theme in wordpress and want to add some fields to the option menu example: dropdown,Text fields etc. but i want to do it using array like: $options = array ( array( "name" => ...
0
votes
1answer
30 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
11 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
27 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
18 views

get ASC order values from array post meta value [closed]

I am getting the array values like this: $wpjobus_resume_work = get_post_meta($post->ID, 'wpjobus_resume_work',true); after printing them on the screen (by print_r($wpjobus_resume_work)): ...
0
votes
0answers
12 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
27 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
37 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 ...
-1
votes
0answers
28 views

2 Array Objects only return 1

I have a post with 2 image attachments. But when I do: <?php $attachments = get_children( array( 'post_type' => 'attachment', ...
0
votes
1answer
11 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'); ...
-1
votes
1answer
32 views

Custom Post Type Loop inside Array [closed]

I current have a custom post type loop: $args = array( 'post_type' => 'locations', 'posts_per_page' => 10 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : ...
0
votes
0answers
36 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
35 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
37 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
18 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
28 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
36 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
19 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
35 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
24 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
33 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
27 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
43 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
152 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 ...
0
votes
0answers
35 views

Use $wp_customize->add_control to create a selectable “Designed/Powered By” choices select w/ link in footer?

I'm trying to figure out if it's possible to use the Customizer controls to create a "Designed By [name]" dropdown menu, and have it echo out the name of the person/group with their name as a link to ...
0
votes
0answers
24 views

stuck in $args value insertion how to pass more than one value

I am in a middle of building a plugin and some how I manage to limit profiles to show only with the users with role regular_user by putting this line in my code $args['role']='regular_user'; ...
0
votes
1answer
42 views

get_posts() using an array of post ids [closed]

There's an array of post ids, and I'd like to use it to load these particular posts. I'm using get_posts() but there's some kind of problem using an array for 'post__in' argument. Here are the ...
0
votes
0answers
89 views

Wordpress WP_Query Array Custom search via taxonomies

Im trying to write a custom search function for my wordpress site. Im using WP_Query and multiple arraylists. Is it possible to order by search after taxonomy = pa_felg-bredde ? Here is my code so ...
0
votes
1answer
18 views

CPT while loop not working

I am having problems getting anything out of this while loop: <ul> <?php $query_args = array( 'post_type' => 'Smart panels', 'posts_per_page' => 5, ...
0
votes
1answer
35 views

Array sorting by custom field date

I want to order the array by a date field called date_start but how do I include a meta key for this if I already have one? $currentshowid = get_the_ID(); $today = date('Y-m-d'); $args = array( ...
0
votes
0answers
144 views

Unserializeing multiple column values that are stored in one database results variable

Lately i have created a custom template to search for data in a database, and also displaying it, by the use of checkboxes. So, a user can select multiple checkboxes to search data on and the query ...
0
votes
0answers
47 views

Page doesn't load

I have following code, but my page doesn't load anymore. What is wrong? require( plugin_dir_path( __FILE__ ) . 'menu.php'); require_once( plugin_dir_path( __FILE__ ) . 'getuser.php'); add_action( ...
3
votes
1answer
55 views

Autogenerate wordpress shortcodes using array?

I was create a shortcode which automatically generate shortcodes with given array key and value. Function names does not generate dynamically. Note: Array KEY = ShortcodeName and Value = Wordpress ...
0
votes
1answer
52 views

How to use an array of categories as a dropdown?

I need to use an array of existing categories as a dropdown option value then use the selected category ID. More exactly, I try to make a custom module to display the latest posts form selected ...
0
votes
2answers
60 views

how to store arrays into a database

I'm trying the store multiple rows into a database. The number of fields will change. Below is the way that I use to store just one row. <?php if(isset($_POST['save'])){ ...
0
votes
0answers
52 views

Meta-Box to add multiple items one at a time and on publish save all

My example custom content type is for recipes. There will be a meta-box for ingredients. In this meta-box there will be three attributes and a "add" button. Name Measurements Notes Add Button My ...
0
votes
0answers
35 views

using array in wordpress database query

I have a strange situation, i'm working on wordpress website and creating a export plugin. On one page i have products name with checkbox and once i select few and submit it pass the value to next ...
0
votes
0answers
106 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
72 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 ...
2
votes
2answers
778 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
101 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
46 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
108 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
25 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
28 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
29 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
23 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
518 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
780 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 ...