All Questions
3,326 questions
0
votes
1
answer
41
views
set up a Wordpress query to show only a specific number of the last posts from specific custom post types
I'm building a new website with Wordpress and Elementor Pro and I don't know how to do what I asked in the title.
Basically I have 3 custom post types that I created with ACF that are called 'News', '...
0
votes
1
answer
13
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
22
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
15
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
18
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
19
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
21
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
31
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
10
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 ...
0
votes
0
answers
12
views
show title and displaying link gallery
I'm looking to show a gallery list ( 1 pic + title of gallery + link to gallery) on one page.
I have catch id galleries...
it's good for the first line. I've Pic + title + link
But for the second... ...
1
vote
1
answer
38
views
Why does 'get_the_ID' work outside of the loop?
on WordPress Developer Resources website's page related to get_the_ID() function it says:
Retrieves the ID of the current item in the WordPress Loop
But I can use it outside of the loop and it works ...
0
votes
0
answers
25
views
Alternatives to archive.php
Our site currently has a LOT of tags, which visitors get to via the main nav, sub nav, etc. This results in a LOT of tag/category pages.
The traditional paginated list of posts isn't a great user ...
0
votes
2
answers
717
views
fetch from an external api call and display results in page
I have placed my external api call inside the functions.php file in the server and I created a shortcode for the api call.
I'm familiar with React and I was expecting Wordpress to be somewhat similar.
...
0
votes
0
answers
37
views
Advanced Custom Fields in WP_Query: Href Returning Empty
I'm still learning the ropes of PHP so please bear with me!
So basically I have an ACF URL field "author_link" that I want to generate on a "table of contents" page in a list ...
0
votes
0
answers
20
views
Add "New" Sale badge to products in WooCommerce based on creation date
I tried to add the label "new" to products created within the last 30 days by adding an action to the "woocommerce_before_shop_loop_item" hook. However, it's not working.
function ...
0
votes
1
answer
42
views
How to get total posts count for each date?
function test_dashboard_content() {
$args = array( 'posts_per_page' => -1, 'post_type' => array( 'post', 'page' ),
'post_status' => 'publish', 'date_query' => array( 'after' => '...
0
votes
1
answer
44
views
How to make FSE's query loop to order by comments number?
I apologise deeply if this topic already been answered here in the past. I have searched for an answer and couldn't find.
The question is regarding Gutenberg, FSE editor, block theme: is it possible ...
0
votes
0
answers
259
views
Elementor : display only one category in loop grid
I'm having some issues with the loop grid in Elementor. I have two categories on my website and created two loop grids. I want to display only one category in each loop grid so I used some CSS to my ...
0
votes
0
answers
20
views
WordPress current post functions inside loop doesn't work anymore, are they incompatible with php 8.0?
I recently update php from 7.4 to 8.0 , since many functions doesn't work anymore !
I don't know if it's related but I have tried many solutions and none of them works.
Using (get_...) , the_title, ...
0
votes
1
answer
50
views
Global $post value outside the loop
On a category archive page, in a filter called from a block outside a loop, I noticed that the get_post function with a null first parameter returns the first loop's post.
Is it supposed to return ...
0
votes
0
answers
15
views
Show Featured products with custom taxonomy template
I have a custom taxonomy template / archive called taxonomy-brand.php and this loops fine and shows the products that have the same "brand" taxonomy, trouble is I want to have a second loop ...
0
votes
0
answers
15
views
Displaying Car Prices from Page Listings on Each Post Car Pages (Post Type) Using ACF
I've introduced a new post type in WordPress named "car" where I showcase the specifications of various cars. I've extensively utilized Advanced Custom Fields (ACF) with numerous fields for ...
1
vote
0
answers
11
views
Add More Featured Data Not Sending to Database
I have made one form which is two step based. also i have added feature add more. So when you add click show same filed duplicate on step two.
Problem----
When i'm trying to send data by (add more) ...
1
vote
0
answers
24
views
Custom loop menu is not working
I am using the below code to create a custom WordPress menu for mobile. With this code, nothing is return. Even the menu is not retrieving. Can anyone assist me with this? This is a multilingual ...
0
votes
2
answers
32
views
List of published post dates only outputting one date
I have the following, which works, but only returns a single post date:
function test() {
$args = array( 'posts_per_page' => -1, 'post_type' => 'post', 'post_status' => 'publish' );
$...
1
vote
1
answer
495
views
Using Query Loop Block to list all posts under each category
I am using Query Loop Block to list all posts under a custom post type. But I want to display all posts under each individual category, is that possible using query block?
Something like this:
...
0
votes
1
answer
23
views
Loop through categores and posts of a custom post type in WordPress?
I've created a custom post type called faq in WordPress and I've created a few categories for it - like "Billing" and "Shipping". My end goal is to create multiple FAQ "Posts&...
0
votes
0
answers
30
views
How to display only posts from the last day with posts published?
The goal is to show today's published posts or, if there's none, the last day's with posts published posts.
I found this old question, but the code suggested uses query_posts. I'd like to use WP_Query....
0
votes
0
answers
27
views
Default post showing more than intended
I have a ajax set up where I am loading post categories via ajax request on click of a button.
I have a default query that is loaded for when the ajax filter is not set so a default state.
It should ...
0
votes
1
answer
34
views
Splitting query results, on the frontend, into separate sections based on meta value without multiple loops?
I have a query, sorted by a meta field, and I am trying to figure out how to split the query into different sections based on the meta field. Essentially I want there to be an h2 and a ul for each ...
1
vote
1
answer
63
views
Grouping posts by 2 different taxonomies
I have the following issue: I have a custom post type (books) with the following taxonomies (1) Categories and (2) Series. Within categories, I have 4 genre sub categories and all books are divided ...
0
votes
1
answer
58
views
Query Multiple Post Types and Paginate Newly Created List
I know this has be asked several times but i cant seem to find the answer anywhere. My site has a resources page which is my archive for all resources (archive-resources.php).
I'm trying to also ...
0
votes
1
answer
138
views
Multiple queries and pagination
I have a homepage and an archive page where I call a template part to have a hero section for the most recent posts, and then loop through the remaining posts as usual.
Essentially I don't want to ...
0
votes
1
answer
22
views
Unexpected warning message to my WordPress posts which group and listed out by year
I have my WordPress posts looped and listed out by year successfully.
However, I am unsure why I still received a warning message.
Warning: Undefined variable $year_check
Below are the codes that I ...
0
votes
1
answer
35
views
Different date time in results of search
In my search.php file i have a loop which succesfuly gives list of search query.
global $wp_query;
$total_results = $wp_query->posts;
if ( $total_results ) :
foreach ( $...
-1
votes
1
answer
147
views
button onclick with get_post_permalink
I developed a custom post type.
On my archive page for each post there is a <button>.
The problem is that I can't put the link to the post in question.
My button is in my loop.
<button type=&...
0
votes
1
answer
62
views
Loop a Single Taxonomy and Output all Posts Associated (but also show a message for empty ones)
I have a custom post type for Vacancies, with a Taxonomy of Location set up. What I've achieved is looping through all Locations and then showing underneath associated posts.
Update: Thanks to @...
0
votes
1
answer
61
views
How to assign to each output values from foreach loop to a meta_key?
For a custom plugin with add start and end date of event/post, I must generate several datetime with the same meta key to compare the period of event with the period of weeks. I my case I'm obliged to ...
0
votes
0
answers
170
views
Getting the correct post ID in Wordpress query loop
I'm trying to add custom field values inside a Wordpress query loop, so that I can have a list of titles, excerpts, and extras like start ratings in the loop results. I want to use something like echo ...
0
votes
1
answer
36
views
Create side bar widget showing list of years as hyperlinks for a custom post type
I have a WP site using Elementor Pro. I have created a Custom Post Type called "Meeting"
I have created an archive page for "Meetings" using a Loop Grid To display the post ...
1
vote
0
answers
78
views
How to Filter the Custom term loop based on dropdown
I had created on Custom Post Type 'resource', which has 4 taxonomies ('type', 'sector', 'industry', 'rtag')
now i had added 45 posts in following manners
Type - Brochure, Infographic, Research Paper, ...
0
votes
1
answer
41
views
Giving each loop post unique numbers so that Wordpress would treat separately
So I got this code right now.
The problem I get is that it executes only for the first video.
I know I need to give each loop post a unique number in order for WordPress to treat them separately. Same ...
0
votes
1
answer
111
views
Is it possible to use the_post 2 times in one loop
I have a page on which I want to display all my posts from my custom post type, which I am able to do in a single column. However, I want to display the posts in 2 columns.
For this, I will need two ...
0
votes
1
answer
1k
views
get_the_ID() retrieves same ID on Gutenberg's Query Loop
I'm using Gutenberg editor and I want to add a shortcode (using XYZ PHP Code) that uses the post id to retrieve certain ACF value.
I'm editing the home page where the last blog posts are shown, but I ...
0
votes
1
answer
61
views
How to show correct td of table tags in wp_query loop
I Have this loop:
<?php
$post_ids_fetched = array(347, 258);
$editor = new WP_Query(
array(
'posts_per_page'=>4,
'post_type'=> 'earth',
'post__in' =&...
0
votes
1
answer
155
views
SOLVED: Shortcode to display Divi project filtered by tag in WP Query loop
I'm creating a template for a custom post type & I'm trying to add a WP Query loop displaying specific Divi projects filtered by tag. I'm inserting the loop using a shortcode, & I've ...
1
vote
0
answers
36
views
Wishlist Icon in Divi Blog module (loop)
I use the Divi Blog module (loop), but it lacks some functions. So with a childtheme and code I retrieve post meta in the Divi Blog Module, thats all working fine. But, I also want a working wishlist ...
0
votes
2
answers
351
views
ACF - How to get custom taxonomy term image field
I have loop that displays only the direct children of a term on a taxonomy page. I also have image field, attached to custom taxonomy. Now, I want to display image in my page template:
<?php
$...
0
votes
1
answer
40
views
Unexpected number of loops in while
I wanted to test how many times a while would loop through a query array.
$WatchListArgs = array(
'post_type' => 'post',
'post_status' => 'publish',
'category__and' => array(...
0
votes
1
answer
21
views
I’m Trying to Separate the First Post From the Rest of the Loop
The layout I’m marking up and styling calls for the first post to be full width while the rest of the posts are not. Here’s my block of code:
<main>
<?php
// Define how the loop will fetch ...