The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
22 views

Struggling with array and foreach loop

I have a function that outputs an array with 2 objects(?): Array ( [de] => 166 [it] => 167 ) Where [xx] is de language code and the number is the pageID. I'm having a meltdown in my brain as I ...
0
votes
0answers
55 views

Need help with a foreach loop with custom post type and taxonomy

I am looking for help with a foreach loop for taxonomy inside of a custom post type. Please note, my php skills are poor. The goal is to have a custom post type (CPT) called retail location that has ...
1
vote
1answer
17 views

Get post thumbnail from subpages with a foreach loop

I have created a page that loads content from it's subpages. The subpages contain post_thubnails. I use a foreach-loop to get the content of all pages. I just can't get the images loaded. <?php ...
0
votes
1answer
18 views

Why loop renders only last metabox from array? [closed]

The auestion is, why my foreach loop renders metabox only with information from last array? The code of class: class CusomMetaBox { /** * Hook into the appropriate actions when the class is ...
1
vote
1answer
43 views

Show only one category

I have this code to show cathegory like image: <?php foreach((get_the_category()) as $cat) { $catname =$cat->category_nicename; echo "<a href=\"/category/"; echo $catname; ...
1
vote
0answers
21 views

Category lists page foreach Paging

I use the following code shows the classification of the article with a list of all the category list on the page template, but such a page will be displayed all categories. I hope one page displays ...
0
votes
1answer
56 views

Invalid argument supplied for foreach() in search.php

I'm using this code on a search.php template to display search results, posts are formatted differently using a template part depending on the post term. This method works great on the index.php but ...
1
vote
1answer
21 views

I need to get an array from the wordpress database

I need to convert this code //This creates an array from the database and allows us to use it later in the jquery //CREATE SQL STATEMENT $sql_locations = "SELECT * FROM tbllocations"; //EXECUTE SQL ...
0
votes
1answer
77 views

Can't get post thumbnail to display in foreach loop

I've been trying to get the post thumbnail to display in the foreach loop for a few hours now and I can't figure out how to make it work, any help would be greatly appreciated! <div ...
0
votes
0answers
29 views

Display custom post type with is taxonomy in homepage

I've a custom post type called "books". Inside there're many book that belongs to a custom category (made with taxonomy) selected by user. All of these books, made a carousel for each taxonomy in ...
0
votes
1answer
45 views

Custom Post save causes 500 error

Been having issues with getting a 500 error. Sometimes a change is saved, usually not. I've output the $key/$values to verify it's reaching the function and foreach. The output is the first ...
0
votes
0answers
25 views

How to display custom taxonomy grandest children in three columns, with first child as column heading?

I have a taxonomy structure thats 4 levels deep, with the name 'services_tax': Parent - Child - - Grandchild - - Grandchild - - - GrandGrandchild I am trying to get the terms selected on a custom ...
0
votes
0answers
17 views

Is it possible to loop bbp_register_view?

I added a taxonomy (location) to bbPress topics. I tried to register views for all terms, but it doesn't work. How to register for all terms? function taxonomy_custom_views() { $args = array( ...
0
votes
2answers
46 views

How do I turn these values from MYSQL into an array

I am working on a custom query to show a few posts. I am able to output all the post ID's. I am trying to turn these ID's into an array so I can use 'post__in' => $myarray in my query. How can ...
0
votes
1answer
15 views

Stop the execution of foreach loop which extract data from array?

In detail the condition is There are multiple new users to whom admin want to send welcome message but only once for each member. I have done sending message but if the member refresh his email page ...
0
votes
0answers
17 views

$wpdb->get_var not matching after first loop through foreach

I'm trying to match my array with a entries in a table and retrieving the ID of the entry. So I have the following array called $features. Array ( [0] => Body Side Moldings: ...
0
votes
0answers
26 views

Wordpress: Trying to echo taxonomy slugs of individual downloads, but limit them to the $atts[category] selected from shortcode from post

Note: I'm a reasonable newcomer to .PHP, starting with this project. I understand the concept of it, but I'm not yet skilled enough to figure out what functions I need to use for something a bit ...
0
votes
2answers
179 views

Most elegant way to enqueue scripts in function.php with foreach loop

I wonder is there a way of running wp_register_script and enqueue with the help of foreach loop to manage label and dir? For example, function wbs_app_components(){ $scripts_list=array( ...
1
vote
3answers
308 views

Limit number of pages in pagination

I have more then 500 posts and I want to limit only 100 posts with pagination. So, 10 pages with 10 posts in each. Here is my code. $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ...
1
vote
2answers
55 views

WP Query. Is there a maximum size?

I develop a plugin that searches for a duplicates of WooCommerce products in a very specific way. It works great in our test environment, but on the client's original setup it does not execute. It ...
0
votes
1answer
278 views

How to iterate within Magic Fields Group foreach loop?

Okay so I'm using Magic Fields 2 on an old WordPress project (rather than ACF unfortunately) and I've got some confusion happening while I'm writing PHP. Basically I'm on a page template that calls ...
0
votes
2answers
33 views

Output column number according to active sidebars

$sidebars = array( is_active_sidebar( 'footer-4' ), is_active_sidebar( 'footer-3' ), is_active_sidebar( 'footer-2' ), is_active_sidebar( 'footer-1' ...
0
votes
1answer
37 views

Foreach only outputs if id is 0

I'm developing a plugin. On the activation hook i do this: /* Create category */ global $wpdb; $rpdb_category = $wpdb->prefix . "rp_category"; if($wpdb->get_var("show tables like ...
0
votes
0answers
80 views

Reorder results of select query by distance

What I'm trying to achieve is a store directory listing nearby stores, ordered by distance. I've managed to grab all the stores within the specified radius and display them, and also calculated the ...
0
votes
2answers
224 views

Stop Duplicating Terms in a Foreach Loop

I have a foreach loop that prints out custom posts which uses a custom taxonomy. The user can then add whatever term/s they like to each post. This then prints out a list of terms on the custom ...
0
votes
1answer
302 views

Get Gravity Forms field values and count how many? [closed]

I don't know how to explain this the best way. But, I am using a form in Gravity Forms for rating something 0 - 10. In the code below, I can get the results. However, I need to see how many ratings ...
0
votes
2answers
38 views

get_post orderby not working in plugin

Please take a look at the loops below, I'm having issues trying to order the attachment by title, name, and modified. <?php foreach ($instance['data'] as $id) : ...
0
votes
2answers
275 views

Using ACF custom field for custom post type to order categories

I'm trying to use this answer to order categories based on their Advanced Custom Fields custom field: track_order. I'm able to get the UL to print fine and show the custom field numbers but I'm ...
0
votes
0answers
146 views

Check ACF fields in foreach custom taxonomy

I currently have a custom post type page set to pull in data that's attached to a custom taxonomy with ACF: <?php $terms = get_the_terms( $post->ID, 'artists' ); foreach($terms as $term) : ...
0
votes
2answers
245 views

Get term name without a foreach loop

I currently have this: <?php $terms = wp_get_post_terms( $post->ID, 'artist-genre'); foreach($terms as $term) : ?> <li> <?php echo $term->name; ?> </li> ...
0
votes
1answer
225 views

List users by meta_key and meta_value

The following function will display a list of users based on their meta data: <?php function get_users_by_meta_data( $meta_key, $meta_value ) { $user_query = new WP_User_Query( array( ...
0
votes
1answer
29 views

How can I modify this code to iterate over an array of categories?

I'm setting up a query for a series of 12 classes that will last a week each. There will be a morning session and an evening session. I'll have two different loops in the template to break those ...
0
votes
1answer
207 views

Foundation modal in wordpress php loop

I'm using Foundation V4 framework within a child theme for a website. I currently have the wordpress post loop outputting all the content as per normal, for images I plan to do something a little ...
0
votes
0answers
171 views

Display Users by usermeta using foreach loop with multiple relationships

I'm getting a real headache trying to sort this one out. Here's my problem: I'm working on a feature for a site that requires Users to be displayed according to their association with a common ...
1
vote
2answers
936 views

Get direct children of custom taxonomy

I've googled extensively and tried my best, but I just can't get the first level children of the custom taxonomy in the code below to work! It only displays the parent level. What I am trying to ...
0
votes
0answers
22 views

How to add additional for each statement

I am using the function below to display the date of an event (using the Event Espresso plugin). I need to add next to the date, on the same line - the city and state of the event using this for each ...
0
votes
1answer
310 views

Different column width in 2 rows with bootstrap and custom post types-different classes needed

I'm using a custom post type on my WP website and also using bootstrap. I want to list 5 custom post type entries on my home page, and I want the first 3 to have class col-md-4 in one row and in the ...
0
votes
1answer
169 views

ACF field not appearing correctly in loop

There is a loop in my theme that displays posts with the following information: a title, some text, and a price. I have added a custom field to this post type using ACF. The field ID is tour_length. I ...
0
votes
0answers
29 views

wordpress database error

I write code to extract peice from website with curl. this should be refresh page to get price. I want store data in the wordpress database with foreach. when I refreshing page but give this ...
0
votes
0answers
103 views

Send Custom Post Notification to Followers

I am trying to modify the function below (which works great for me ) to notify author followers that the author has published a new post, but I seem to be going round in circles. function ...
0
votes
1answer
200 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
76 views

Stuck in the query loop

I created a two loop into my WordPress page. It should get the category name and should load all the child under the Category name. Like this ____ Cat1 ______ product 1 product 2 product 3 ____ ...
0
votes
1answer
2k views

Need to add class to first element in a foreach loop

I'm pulling all attachments for this particular post and displaying them in a carousel. Problem is I need to give the first item a class of active so bootstrap carousel will work. Here is my loop: ...
1
vote
1answer
268 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
166 views

get_the_content within foreach not the loop

I want to retrieve the content of posts within a foreach loop. $recent_posts = wp_get_recent_posts(); $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ...
0
votes
1answer
2k views

preg_replace() No ending delimiter '.' found [closed]

I get this error: Warning: preg_replace() [function.preg-replace]: No ending delimiter '.' found in but I can't figure out why Here is the code: foreach( $content as $item ) { ...
0
votes
0answers
278 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 ...
0
votes
0answers
52 views

Update options and then display it all in a foreach loop

I am really new in wordpress development but not new in coding, what i would like to do is to make my own countdown wp plugin. The problem as a beginner is that i dont understand how works the wp ...
0
votes
1answer
169 views

Strange switch_to_blog() issue

OK, so WordPress has been destroying me this afternoon and this particular issue I really can't figure out. We are building a multisite network and for our particular purpose need to loop through each ...
1
vote
2answers
442 views

how to save selection meta data in user profile on frontend

Hi can anyone help me to save the post title selected in this select box? I would like to let people select posts out of a dropdown select box and save the value to their profile. Help is very ...