All Questions
400
questions
0
votes
0
answers
20
views
Show post in elementor based on views and specific category with query id feature in elementor
I have two functions for query filter:
function my_query_filter_most_views( $query ) {
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'meta_key', 'entry_views' );
$...
1
vote
1
answer
47
views
External WP_Query call from PHP crashed after version update
I have an external script that does some DB maintenance through WP_Query and similar functions. It used to work great, but now after a PHP version update (from 7 to 8) it stopped working.
The ...
0
votes
1
answer
25
views
Check for a value in a custom query
I have a custom query to show people working in a specific division (label) in an organisation.
I want to display the specific division’s name before the cards of the people are displayed.
Currently I ...
0
votes
1
answer
41
views
wp_logout action hook is not firing
Why the user meta value is not being changed after logout using the following code:
function update_login_status_on_logout() {
$user_id = get_current_user_id();
if ($user_id) {
...
0
votes
0
answers
20
views
How to make posts_like_dislike reference current post when iterating?
I am using plugin https://wordpress.org/plugins/posts-like-dislike/ . It adds a [posts_like_dislike] shortcode. When inside the default wordpress Twenty Twenty-Three in posts "Blog Home" ...
0
votes
0
answers
20
views
AND and OR in my CPT search query depending on checkbox
I have a checkbox, that when checked is supposed to change a query from AND to OR. The moods, genres and the checkbox data comes through just fine via a ajax call, and based on this, it will filter a ...
0
votes
0
answers
229
views
Sort posts by category and date using php and custom query
I am using Elementor Pro and Advanced Queries and also ACF for custom date. I have 2 types of posts that are events - event 1 and event 2.
I have an event calendar on the first page showcasing the ...
0
votes
0
answers
43
views
Add css class ID to largest and smallest number a custom field in wp_query
I have a wp_query for get a ACF number field. I want to add a css class ID to the largest and smallest number in the loop.
<ul>
<?php
$editor = new WP_Query(
array(
'...
0
votes
1
answer
40
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
2
answers
238
views
Exclude first post from wp query
I am building a WordPress website and I want to show post in it. But the problem is that, I want to exclude the first post in query. I have not much knowledge of PHP. So please help me to de this.
...
0
votes
1
answer
212
views
How do I display WooCommerce products in my query to rows of 3?
I have created a WooCommerce search plugin. It fetches products, however it only displays the products as one per row.
How can I amend my query to display 3 products per row? Here is the function:
...
0
votes
1
answer
24
views
How to get posts by a certain author in inner loop using outer loop variable or post title WordPress
I am working on a WordPress site with staff bio pages. At the bottom of the page, I would like to include their most recent blog posts (if they have any). I have an outer loop that pulls the fields ...
0
votes
1
answer
323
views
Accessing Correct Database to Create REST API Endpoint
So I have multiple databases associated with the database where my wordpress website is hosted. I was wondering if I can access all of said databases with $wpdb or will I need to initiate a connection ...
0
votes
0
answers
101
views
How to sort search result by post_title, then by post_content
How to sort search result by post_title, then by post_content
For example - if i search for word "Ball" i want to get results where "ball" exists in title, then the results where &...
1
vote
2
answers
223
views
How to use a conditional statement in a post loop but not count towards the "posts_per_page" if false
I have a WP_Query which has the "posts_per_page" parameter set to 12. I am then using a while loop to iterate over all of the posts and an IF statement to check whether a condition is true ...