Questions tagged [loop]
The core of the WordPress query, the loop offers an easy way to access post information and display it on your website.
3,324 questions
1 vote
1 answer
49 views
How do I use fields => ids in an array with WP Query?
In my example below, when using fields => ids https://developer.wordpress.org/reference/classes/wp_query/#return-fields-parameter to get an array of post IDs, why does var_dump($args->posts) ...
0 votes
0 answers
47 views
How can I efficiently process 50k+ Gravity Forms entries without running into memory or timeout issues?
I'm working on a WordPress shortcode that aggregates data from Gravity Forms entries. I have: Around 50,000 entries on an enrollment form Around 30,000 entries on a feedback form Over 200 trainings I ...
0 votes
0 answers
37 views
How to adjust meta value to UTC time in WP Query
I'm displaying three lists of events on my site: past events, current events, and future events. The lists are sorted by a custom date time field. The code I have is currently working, but Wordpress ...
0 votes
0 answers
56 views
Need help with Query Loop. Need to get current taxonomy term and its posts and group them by a different selected taxonomy term
Example: Treatment - (Term of resource_type Taxonomy) Resource Name 1 (term of resource_name Taxonomy) Resource 1 - Post 1 Resource 1 - Post 2 Resource Name 2 (term of resource_name Taxonomy) ...
1 vote
0 answers
60 views
WPFacet multiple loop displaying duplicate content
I have created multiple loop or wpfacet lisiting for featured job(taxonomy) and for main loop which displays job on the basis of location, but https://facetwp.com/help-center/faq/can-i-use-multiple-...
1 vote
0 answers
74 views
Shortcode in loop always display data of first post on the page
I am creating a shortcode to fetch the categories of a given post and display them in a stylish way. I made the following shortcode: function t3_categories_fonction(){ global $post; // Get the ...
0 votes
0 answers
33 views
Run a query for loop ordering by the sum of the inverse of comment age with WP_Query
I need some help creating a specific WordPress query and I am drawing a blank on how to do it. I want to select n posts ordered by the sum of the inverse of the age in days of the comments. I'd like ...
0 votes
1 answer
26 views
Different number of posts in regular loop and CPT category page
I have a few custom post types with custom categories – and i also use the regular posts page for news. At the moment i can only change the number of posts through Settings > Reading > Number of ...
0 votes
1 answer
54 views
When a foreach loop is used multiple times in blocks, is there a way to ensure a variable always has a unique value?
I'm a bit new to this so sorry if my explanations are a bit daft. We use custom gutenberg blocks on our site. One of them is a FAQ block where you can add questions/answers and they display as an ...
0 votes
1 answer
31 views
How could I prevent using the same custom loop in a template file when I only need to change one meta_query parameter?
I am displaying a set of upcoming fixtures for two cricket teams on the same page. The fixtures are created from a CPT and the relevant team is selected from a custom field. I have everything working ...
0 votes
1 answer
48 views
Custom theme on multisite has issues with standard loop output
I am experiencing the following error output when using the standard loop on page.php and single.php on a multisite-based WordPress installation. The loops are the same for both template types, with ...
1 vote
0 answers
27 views
Dinamis Query Loop template Custom Post Type dan Taxonomy di WordPress Blocks dengan PHP
Google Translated: Hello everyone, I’m trying to create custom blocks in WordPress that dynamically display posts from custom post type that I’m creating, which is “products”. I also want to sift the ...
0 votes
0 answers
53 views
Wordpress Post Query Using Custom native MySQL like St_Distance_Sphere
Is there a way to query posts for "the loop". But include some filter on the results based on a mySQL Function like St_Distance_Sphere? Or convert a wpdb->query into a form similar to &...
0 votes
1 answer
88 views
How to get the post title inside a custom block in a loop? block.js
I have created a custom post type and I want to create blocks that display its values. To start with, I created a placeholder that gets replaced with the correct values using PHP. Everything works as ...
1 vote
0 answers
26 views
Inside nested wordpress loop (post & post-type) " in_array()" function can't retrieve the matching value
I want to display the logo of a metadata from post-type for all post matching same name/category. Posts-type: are Activities (sport). Posts: are News from these activities Inside my first loop I get ...