condition for specific pages

The easiest way to do it would be: if ( is_category (‘4’) ) { echo ‘<a class=”btn” href=””>Enquire</a>’; } else { echo ‘<a class=”btn” href=””>Calendly link</a>’; } Obviously you would change “4” to whatever the specific category number is. Also, the WordPress template hierarchy could be helpful if you have add’l changes: https://developer.wordpress.org/themes/basics/template-hierarchy/#category If you … Read more

wp_logout action hook is not firing

In your code, get_current_user_id() will return 0 because this hook fires after the logout has happened, ie, there is no current user ID. If you want the $user_id to be available to your function, you have to pass it in. Note: the $user_id parameter was added in WordPress 5.5.0. If you’re using an older version, … Read more

wp_mail – send emails after 24 hours from users registration

You can’t schedule a future email from wp_mail * but you can use wp_schedule_single_event to run in 24 hours time, and write an action hook handler that calls wp_mail() to send your mail, e.g. something like wp_schedule_single_event( time() + (60*60*24), ‘send_new_user_next_day_email’, args( $userId ) ); function send_new_user_next_day_email( $userId ) { // look up the user … Read more

PHP Warning: Attempt to read property “id” on null

$product->id only works if $product has a value, and sometimes it does not! E.g. on a login page which product would it be? So you need to check if it’s valid/exists/safe with an if check: global $product; if ( ! empty( $product ) ) { // code that uses $product goes here }

Mixed results with is_page() WordPress function, when using $this, or self

You’ve shared that this is how the member variable is defined: class PropertySearch { private static $listing_details_template_name; This means it is a private static variable and can be accessed using static accessor such as self::$listing_details_template_name or PropertySearch::$listing_details_template_name. Additionally, you’ve declared that it’s a private member variable, so it can only be referred to from within … Read more

WordPress PHP8.2 Critical Error in class-wp-widget.php

Seems like the theme you use (nice_hotel?) uses an extremely outdated version of registering a widget (see here). As this seems to be a premium theme, you should probably contact the themes author, but as i couldn’t find an “active” version of this theme (if it is nice_hotel: themeforest theme shows “no longer available”), you’re … Read more

stop resize button for wordpress media

That’s a bit tricky because WordPress doesn’t offer this functionality out of the box. But a workaround would be to stop WordPress from generating additional image sizes for uploaded images. But it will apply to all image uploads, not just those in the WooCommerce product gallery. If you wanted to try it out, here’s the … Read more

FATAL ERROR when I try to change the .php according to required and optional items rule

Nectar_Arrow_Walker_Nav_Menu apparently extends the WordPress Walker class. This means that its methods’ arguments need to match the original class methods’ arguments: public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {} The WordPress class doesn’t have any optional parameters so it doesn’t have this issue. Make sure your method’s arguments match WordPress’ and don’t … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)