I have a WP project with following docker-compose configuration. When I try to connect my http://localhost to access the installation, I get 500 and I read this in the log: PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused in /var/www/html/web/wp/wp-includes/wp-db.php I assume there is something wrong with the ip or the host but the weird thing is that phpmyadmin is working
Tag: wordpress
Automatically Sort Table By Ascending Quantity in Php/html, not sql
I have data, from HTTP requests, that I am rendering in the form of a table. Right now, I just have it so that the listings are ordered as the for loop processes them, but I want it so that the for loop processes them and then sorts the data according to highest % of weight. Weight is a column
Woocommerce conditionally load a custom product template
I am creating a custom theme and I have copied the file content-product.php to my theme folder. There I have made changes to the html structure and css. I can load of list of products and see the changes working via the short code [products]. However elsewhere on the site I want to display another list of products but from
Woocommerce custom email is triggered if specific product ID is in order but not if other products are in the order
I have a custom woocommerce email trigger function in my Woocommerce store. This email function triggers 2 different emails based on product meta data. If specific product meta is empty it triggers email number 1 and if it’s not empty it triggers email number 2. This works excellent when there is only specific ID in my order. Once there is
Limiting WordPress Search to specific blog category not working
So I’m trying to create a search form on a blog page so that it only searches the posts with the category “blog” this is the search form code I’m using: This is the search.php code: When a query is searched, the url loads like it’s limited to the category: https://www.scraperapi.com/?cat=7&s=proxies But it still shows pages that are from outside
How to change variation color based on variation stock status in woo commerce?
working on the website built with WordPress + Woocommerce and I’m trying to change the attribute background color on the product page if it is on backorder. for example, size 4 should have a different background color, because it’s out of stock and available on backorder: WPC Variation Swatches for WooCommerce by WPClever is used for attributes. I’m implementing following
Display out of stock products on specific category – Woocommerce
I use the woocommerce / inventory menu settings to hide all of the “out of stock” products from category listings. But there are some products them i want to display in certain categorys even is the stock is 0. Is there a function that can override the upper “main switch” in certain categorys? Answer Somehow I coudnt find it before,
Php function serialize() returns s:value but i don’t want this ‘s:’.What should I do?
I got this as an O/P: s:287:”a:3:{s:6:”actors”;a:2:{s:4:”name”;s:6:”Actors”;s:5:”value”;s:38:”Felicity Jones, Diego Luna, Alan Tudyk”;}s:8:”director”;a:2:{s:4:”name”;s:8:”Director”;s:5:”value”;s:14:”Gareth Edwards”;}s:6:”writer”;a:2:{s:4:”name”;s:6:”Writer”;s:5:”value”;s:36:”Chris Weitz, Tony Gilroy, John Knoll”;}}”; My Code:- I don’t need first s:287″ but this thing automatically save in my database. Help me please.. Answer The WordPress function add_post_meta() tries to serialize the passed data for itself. As you can see in the documentation of add_post_meta() it calls
Updating meta value for specific ids
I am updating post meta with this How can I add this metakey and metavalue not only to post ID 3100, but several other IDs? Answer You can define array of post ids and then you can iterate loop of ids. Try the below code. Update as per OP comment.
How to display extra text field on WordPress author page
I want to display an extra text field on the author page which I can fill in the respective user profile when I logged in. Additionally it would be great if the textfield has a WYSIWYG editor. How can I do that? Answer You can use the hook user_contactmethods to add some custom fields to the user page. See this