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
21 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
19 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
22 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
21 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
69 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
13 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
23 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
27 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
50 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
15 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
25 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
45 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
24 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
49 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
27 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
35 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
37 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
54 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
66 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
455 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
59 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
40 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
81 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
23 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
26 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
27 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
22 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
326 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
636 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
54 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
162 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
81 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
31 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
46 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
384 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
70 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
109 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
130 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
28 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
141 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
58 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
1answer
46 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
18 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
103 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
136 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
17 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
1answer
97 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
42 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 * ...