Date not working correctly

What you did wrong here is the part date(‘d’, $rem_days). The function date() should be used to convert timestamp to a formatted date, not to converting a time difference in timestamp to time difference in days. You can fix this by replacing date(‘d’, $rem_days) with floor($rem_days/86400). The complete code should be: $event_date = strtotime( get_field( … Read more

Calling a PHP function from a menu item

There’s a few things to consider here. 1) You should always first check for a third-party plugin like WPML. If, for whatever reason, WPML stops working or gets deactivated, assuming it’s there could result in a fatal error. function directByLang() { if( defined( ‘ICL_SITEPRESS_VERSION’ ) ) { $current_lang = apply_filters(‘wpml_current_language’, NULL); if ($current_lang == ‘en’) … Read more

Custom Search Function in WordPress Returns No Results

Here’s the right code I made a mistake with s param function custom_search_query($query) { if (!is_admin() && $query->is_main_query() && $query->is_search()) { $search_query = get_search_query(); // Retrieve the search query $api_url=”https://api.adenwalla.in/api/search/data”; $args = array( ‘body’ => json_encode(array(‘query’ => $search_query)), ‘headers’ => array(‘Content-Type’ => ‘application/json’), ‘timeout’ => 60 ); $response = wp_remote_post($api_url, $args); $body = wp_remote_retrieve_body($response); $results … Read more

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