Tagged Questions

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
5 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
23 views

Custom Post Type Loop inside Array

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
27 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
0answers
13 views

How to center an array of thumbnails? [closed]

I am creating our new page based on wordpress an i am creating an own theme. It should be responsive so i can ot work with a specific width of my site at all. It works quiet good expect one thing. I ...
0
votes
0answers
12 views

enode correctly the results from $wpdb->get_results to be passed to jquery autocomplete [closed]

i've been reading jQuery's Autocomplete here Now, i'm querying the db with $wpdb->get_results and getting an array as follows: Array ( [0] => stdClass Object ( [c_name] => Data ...
0
votes
1answer
28 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
21 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
16 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
20 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
26 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
12 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
31 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
23 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
31 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
25 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
34 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
111 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
23 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
34 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
69 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
17 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
30 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
95 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
35 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
52 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
40 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
47 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
48 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
81 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
71 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
633 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
80 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
43 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
94 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
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
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
443 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
727 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
13 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
57 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
222 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
87 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
33 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
54 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
492 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
73 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' => ...