Questions tagged [comparison]
The comparison tag has no usage guidance.
31
questions
1
vote
1
answer
29
views
How to compare Event period with Week period using get_posts(), meta_query, relation and compare
I have many posts, each post is an event with a period .
This period can be 3 hours, 3 days, 15 days, 3 month.
I defined the start time of event with start_timestampevents and the end with ...
0
votes
1
answer
41
views
ACF number less than comparison not working
I have two ACF fields named as “price” and “reduced_price” now i have another field named as “price_filter” which should be filled with following conditions,
If “price” is greater than “reduced_price”...
2
votes
0
answers
154
views
How to efficiently find "duplicate" posts, where the titles are different, using metadata to match posts?
The website I'm working on collects information on film reels. A 'film' is a custom post type. Each 'film' is one post.
The user bulk uploads films from different sources. Because of this, some films ...
0
votes
1
answer
116
views
If X Amount of Time Has Passed Since Post Was Published, Do Something
if ( human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ) < strtotime( '7 days' ) ) {
echo 'New!';
}
I've also tried:
if ( get_the_date( 'U' ) > strtotime( '-7 days' ) )
if ( ...
0
votes
0
answers
67
views
Compare time value in WP_User_Query for sending emails
I am trying to setup a custom plugin that will compare the time (last activity of a user) and send emails to them. I am using the below WP_User_Query and a cron job
function reminder_email() {
// Get ...
1
vote
1
answer
36
views
Meta Query Compare with Date
$metas[] = array(
'key' => 'event_date',
'value' => array(date('10/10/2020'), date('10/11/2020')),
'compare' => 'BETWEEN',
'...
0
votes
0
answers
1k
views
Comparing two dates (ACF and current time)
I’m trying to compare two dates (the current date with an ACF datepicker one) to display specific content.
What I’m trying to achieve is to display a phrase if the ACF date is lower than the current ...
0
votes
1
answer
45
views
PHP question: how to combine syntax?
could someone please tell me where the mistake is in my PHP code? My PHP knowledge is extremely rudimentary although I have tried it with http://php.net/manual/de/language.operators.logical.php :-D
"...
1
vote
2
answers
425
views
Comparing between a negative and positive number
I'm having some difficulty comparing between a negative and positive number. This code works fine when it's between two positive numbers but not when it's between a negative then a positive one.
This ...
7
votes
5
answers
4k
views
How to handle optional end date in compare clause in meta_query
I have a custom post type event in WordPress, and I need to query upcoming event posts comparing $current_date.
Query conditions are :
start_date is a valid date always
end_date can be a valid date ...
0
votes
1
answer
3k
views
Conditional statement for dates
Im trying to create a conditional statement comparing two dates.
I have a ACF custom date field as one date, and then comparing against the current date.
Below is what i have and iv echoed both $date ...
0
votes
1
answer
76
views
Compare date of user's last posts
I want to compare the date of a user's last two posts. I'm new to WordPress developing. I have written this code but I'm not sure if it's correct. Please help me in correcting it:
$ID ...
0
votes
1
answer
359
views
Conditional string comparison failing for basename/slug
I am trying to display a particular block of html for one page in particular. I have created a conditional statement that compares the basename of the page to my string.
<?php if ( has_tag( '...
0
votes
1
answer
1k
views
Get previous posts list
I'll give up. Have searched and searched and tried and tried... Can't find any solution to list previous posts.
On a single post: I want to show a list of the 10 previous posts, the 10 before the ...
0
votes
0
answers
892
views
WP_Query using meta_query with LIKE doesn't return what it should
I am using this code to get stuff based on my custom field and custom content type.
$searchTerm = 'bestafricanvideos';
$args = array(
'post_type' => 'sitemaps',
'posts_per_page' => -1,
...
0
votes
1
answer
74
views
Comparison operator
I've build a dropdown box with a list of comparison strings.
array(
'value' => array(
__( 'Equal', 'js_composer' ) => '=',
__( 'Does not equal', 'js_composer' ) =...
0
votes
1
answer
307
views
Filter posts/pages by user_role array
I have made a code for to filter wich pages to show depending on your user_role. Everything was alright. But my customer created NEW roles with similars name/slug.
So now, if some 1 have the role ...
1
vote
0
answers
267
views
How to compare two posts including their meta fields on a scalable base?
I have set up a wordpress in a way that posts can be cloned and be altered by a different author. whenever this is the case, i want the administrator to be notified via an additional tab in the edit....
0
votes
1
answer
148
views
How to display checked posts on another page over AJAX? (like comparasion style)
I wanted to create an "comparasion" model for my WordPress Website, but gone bad at that.
I cannot figure out how to ...
On one page I have displayed post (custom post type, ex. "Products"). Next to ...
0
votes
1
answer
123
views
About WP's save_post action
Quick question, in API's some times save_post is used(most of the time actually).
Is save_post the equivalent of the query action INSERT INTO whereas save_post saves metadata and forces Wordpress to ...
0
votes
1
answer
166
views
Custom Post Type or Shortcode, What to choose? [closed]
While developing a multipupose theme for mass audience, i’m facing an issue.
I’m going to code staff listing section. Now i was wondering, what should i do?
1: Create dedicated Custom Post Type for ...
8
votes
2
answers
10k
views
What is the difference between get_page_link and get_permalink functions?
Both functions return permalink to the post or page by it's ID. What are the differences and which of these functions should I use in which cases?
0
votes
1
answer
494
views
Comparing Time with the_time();
I am trying to make a function that will check the time associated with a future event (cpt) with the current time, to see if the event has past. When I first collect the time it is in seconds and I ...
1
vote
3
answers
324
views
WordPress or Drupal for data-heavy content site
Looking to build a very data-heavy content site and not sure if what I'm looking to do can be accomplished in WordPress (my preference) or even in Drupal for that matter. The problem isn't the ...
2
votes
2
answers
1k
views
Check to see if page exists problems
I've created a class to dynamically create pages. I'm checking to see if the page exists by comparing the new page's title to post_name. The comparison seems to work ok, but even if there is a match ...
1
vote
1
answer
2k
views
Is there a Wordpress version that is incompatible with PHP 5.3?
Is there some decent information available which WordPress versions do not support PHP 5.3? I mean the more recent ones like 2.9 / 3.0 / 3.1?
I'm only concerned about the Wordpress core codebase, not ...
2
votes
3
answers
2k
views
get_transient(), PHP switch(), and comparison operators
Im using a WordPress transient, which expires after an hour, to store a value which is an integer. Im trying to use switch() and multiple case() statements to evaluate if the transient exists or not (...
0
votes
1
answer
151
views
Deactivate plugin on registration
I'd like to check if the server is running PHP5.2. To do this, I use a activation-hook which will be registered with "register_activation_hook". Instead of just returning a warning, i'd like to auto-...
-2
votes
2
answers
310
views
How customizable is a self-hosted WordPress blog compared to a Blogger blog?
I currently have a Blogspot blog and I'm thinking of making the leap to a self-hosted WordPress one instead. Everything I've seems to suggest this is the best way to go for the best possible ...
0
votes
2
answers
378
views
How to get events using multiple custom meta fields?
I need to grab a list of current events. The events have a start and end date so I need to be able to select a range as opposed to just getting any list of events that have an end date that is after ...
1
vote
3
answers
319
views
What are the advantages of WordPress over other systems?
I've tried to explain the benefits of WordPress to others; comparing it to static sites is easy, as (most) everything can be done online with WP. I have more difficulty comparing and contrasting with ...