The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
0answers
11 views

How to query post from sub-categories on category archive and display posts?

On a custom taxonomy archive from the taxonomy called 'books' (taxonomy-books.php) I want to list all subcategories that are assigned to the parent category. And then for each subcategory I want to ...
1
vote
3answers
32 views

How to fetch an array in $wpdb?

I have a snippet that will select a data from database table. But I encounter an error: Warning: Invalid argument supplied for foreach() I encounter a new error: Notice: Trying to get property of ...
0
votes
1answer
31 views

Foreach inside foreach

I got two taxonomies: "Colours" and "Recommended Colour" both have the same terms (same colours). I want to display a list of all terms of the taxonomy "Colours" and mark one colour as recommended. ...
0
votes
0answers
24 views

Display most popular posts

I have already found a way to display recent posts: <?php $args = array( 'post_status' => 'publish', 'numberposts' => '60', ...
1
vote
1answer
31 views

Undefined offset: 0

Here is my PHP function function getUserIDandPush($ul){ global $table_prefix; // Prefix for Database table global $user_login; global $wpdb; // Wordpress WPDB database method $dt = ...
0
votes
1answer
17 views

Get terms parent ID for conditional IF statement

I have the following working code to echo the name of the term (taxonomy called prodcats) that a series of posts are in. This is in the taxonomy archive template taxonomy-prodcats.php $terms = ...
0
votes
1answer
27 views

Foreach implode issue

I have this piece of code that gets the values of meta boxes in WordPress. $guiones = rwmb_meta( 'mb_guionistas', array( 'multiple' => true) ); $pieces = array(); foreach ($guiones as $item) { ...
0
votes
1answer
25 views

Remove Featured Images from Posts Older Than a Certain Date

I run a network of sites, with hundreds of editors, and lately we've had image copyright trolls coming after us. Most of these images are a year old or older, so we're looking to remove all images ...
1
vote
1answer
23 views

List terms from Custom Taxonomy

I have registered a custom post type "Projects" and also registered a custom taxonomy for that Post Type called "Project Categories". On my home page I have a div in which I would like to list all ...
0
votes
0answers
8 views

Book-like index on a page with foreach custom field and array merge

I'm trying to make a page with a Table of Contents in which my 'lyric' posts need to be ordered by three different custom fields. Basically each song could either be Original or about a Game, and in ...
0
votes
1answer
46 views

ACF loops false value with repeater and checkbox

I have an ACF repeater field setup on a page and within the subfields I have a True/False checkbox. So far, if the box is checked, it will show the fields. If not then it will not. However, the one ...
1
vote
1answer
32 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 ...
1
vote
1answer
21 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
22 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
46 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
28 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
159 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
23 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
141 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
44 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
84 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
35 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
21 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
49 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
20 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
24 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
35 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
229 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
456 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
78 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
394 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
40 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
42 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
99 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
326 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
408 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
46 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
316 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
2answers
336 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
299 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
31 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
247 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
247 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
1k 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
1answer
416 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
215 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
31 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
115 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
233 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
82 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 ____ ...