$sitepress
is a global set by WPML, IIRC. Change your line 25 as follows:
if(isset($sitepress) && is_object($sitepress)) {
setlocale(LC_TIME, $sitepress->locale() . '.UTF-8');
}
As a general rule you shouldn’t assume in a theme that anything included in or set by a plugin will be available, because it’s possible to disable the plugin while the theme is still active. Always include some sort of sanity check before attempting to access a variable, class or function from a plugin in your theme.
Edit: based on your discovery that the method you used has been deprecated, I’d suggest the following for your updated file:
if(isset($sitepress) && method_exists($sitepress, 'get_locale')) {
setlocale(LC_TIME, $sitepress->get_locale(ICL_LANGUAGE_CODE) . '.UTF-8');
}
Related Posts:
- Take input from form and pass it to function using a wp-plugin
- When unit testing a plugin, does the plugin need to be in the wp-content/plugins directory of the WordPress tests install?
- How can I prevent a plugin from updating unless it’s minimum PHP version is met?
- Simple form that saves to database
- How to call plugin path in JS?
- Get Current user email as a return string value
- WooCommerce – Call to undefined function is_woocommerce()
- How can I make content disappear when a user logs in?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Determining where fopen() is writing files when used from WordPress AJAX call [closed]
- How Restrict access to admin dashboard by specific static ip?
- New Plugin: Post update pushes a copy as a revision
- Overide a function that is inside a plugin
- How to get images from EDD post?
- Add multiple attributes to product from php
- How to install and activate a plugin via an external PHP script
- How to remove xmlns on language_attributes()?
- How to initialize something in unit test before the init hook being called?
- Add category to body class
- Plugin Development sqlite or WordPress’ database
- Add keywords meta to index.php page
- Download any file after submitting a form [closed]
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- woocommerce 3.2.1 not sending order notification emails
- Redirecting a buddyboss profile tab to a different tab if not subscribed to a specific membership
- Add a CSS class based on categroy id to archive pages
- Access WordPress data from external PHP application.
- Why “Call to a member function on a non-object” in plugin only?
- What are the specifics of WordPress development I need to know? [closed]
- How to echo text in browser instead of download junk file?
- How to create a custom post type that contains another custom post type?
- WP Query. Is there a maximum size?
- WP Plugins – Use includes to display page content
- WordPress custom taxonomy not showing
- My WordPress site when down after installing a plugin and now all I get is a simple white screen [closed]
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- execute function after one completed
- WHy custom plugin slows down the loading of the pages?
- Adding media upload button to User Profile page (following a tutorial)
- Pass user role to javascript code inside body
- Integrating boxtal PHP library into a custom WordPress Plugin
- How to get specific string/value from an array? php [closed]
- WordPress Stock Update Programatically
- UTF-32be error WordPress
- Background Music WP [closed]
- Getting a ressource ID, from a WC_Order_Item_Product/Order
- Customize Menu | Styling LESS/SCSS code formats
- How to delete a theme using AJAX
- same user role or copy the user role to be same as the other role
- 500 error when updating plugin option
- Equivalent of admin.php for public pages
- Social share buttons text shows up on post excerpts
- How to displaying Custom image, text and default image logo from Redux Framework option panel
- Plugin Admin panel checkbox unchecked after submit
- Getting URL GET parameter with Code snippets and storing it in database?
- Send Array from JS to php file then insert it in wp database through a plugin
- Offer Download Links for Product Images
- save_post_product action not firing
- How to get the custom field value using SQL query
- Editing a coupon generating plugin
- WordPress fatal error from php protocol codes
- Possible way of having multiple Gutenberg instances for a page?
- Woocommerce add products to cart
- Display pagination in reservation Plugin and and Print table as pdf
- Changing wordpress/woocommerce notices default message to other languages (text)
- Why does my custom plugin only function correctly once per page?
- What is the right way to populate a dropdown from MySql?
- make p tag collapsed after 3 rows
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- Generate and send ICS file through WordPress
- WP Plugin permissions – create new files
- Run a Change Role Cron Job on WordPress via cPanel
- How to display variables from plugin?
- How to make the first letter of a post title uppercase, in a plugin?
- How to echo meta_key in easy digital downloads receipt (Purchase Confirmation page)
- Plugin error “array_key_exists(): The first argument should be either a string or an integer” [closed]
- Creating Admin Submenu Page via Class Method
- .htaccess file doesn’t work, with hundred tries
- How to change the product short description for each product with PHP?
- I want add repository theme folder
- ACF Repeater Field Question [closed]
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- How do I convince this button to do something when it is clicked?
- WordPress function to add text
- TheCartPress plugin – Make every item in store unique
- Doing action based on input from options menu
- Insert dynamic content into posts
- avatar displays outside of targeted area
- WordPress User Frontend Editing Custom Fields
- My wordpress site wont load, it gives header error warnings
- Can anyone see a syntax error in this? [closed]
- Fast Tranfering my WordPress site to another server
- Duplicating wordpress install issue
- How to add custom html to the Media > Attachment Details modal?
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- I want create woocommerec match products columns
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- How to override plugin function in code snippets WordPress
- How to create a “Most Popular” & “Latest” TAB in WordPress