I have been using this code on PHP 7.0, but decided to upgrade to 7.4 tonight. This code automatically inserts widgets into Wordpress sidebar, but it no longer works. From my research, it seems to be a problem with “[]” not initializing arrays anymore. I’ve tried every single way I know how, but can’t get this to work. I’ve always
Tag: wordpress
How to hide alt tag output on page?
Please check the screenshot, let me know how to fix this issue…And you can see there’s no image alt data in HTML. Another thing is that if I use PHP in img src so I can’t set width & height like (300 x 300). The output is a full-size image and if I use a static URL in img it
I am trying to use AJAX to change the orderby and order arguments in a WP_Query, but I can’t determine why my code won’t work [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 5 months ago. Improve this question
Adding css class to featured products in woocommerce
I would like to loop throught all products in shop/category page and add special css class to product if it is featured. I have tried to do this with add_filter hook but it seems I am to dumb to get it working. Answer You were right about using a filter. I don’t know which filter you were trying but you
Woocommerce $product class can’t be accessed inside PHP snippet
I’m trying to write a PHP code for showing extra fields on my product page with “Woody Snippets” in WordPress. But I can’t access the $product class inside my snippet. Is it not possible or am I doing something wrong? Here is my code: Answer I realized the cause of the problem is my theme. My theme uses templates for
WordPress Loop Post Counter Never Changes
I want to style the first post differently so I am trying to use a simple counter that will add a class to the first post. First, on index.php I have this and then on content.php I have but $postcount is always 1 If I move $postCount = 0; and $postCount++; to content.php the value never changes either. I can
Add a quantity radio selector field to Ajax add to cart button on WooCommerce shop page
My product has a maximum quantity of 10. Customers often choose to buy many types at the same time. Hence I want to have a radio quantity selector (1 – 10) at the shop page. I already know how to show quantity picker at the shop page and how to use WooCommerce radio form. But I don’t know how to
WordPress – Second Custom Role Not working
I have successfully created a custom user role called Client and I am using the same structure to create a second custom user role called Broker. I have been stumped here all morning for something so simple, there is no difference other than the required variables and names. The second user role does not show up in the list when
Google Api PHP Client Syntax Error on PHP 7
OS: macOS Big Sur PHP version: 7.4.1 Package name and version: google/apiclient: ^2.12.3 Whenever I switch the PHP version to 7.4.1 I get this error Parse error: syntax error, unexpected ‘static’ (T_STATIC) in /Users/webtechstreet4/Local Sites/fvtest/app/public/wp-content/plugins/form-vibes-pro/vendor/psr/cache/src/CacheItemInterface.php on line 75 The library works great on PHP 8 but gives the above error when switching to PHP 7. Screenshot Answer Actually, I sorted
Saving post id into a session variable after creating a post in wordpress
I am adding an action hook so that after i save a post i will store the information of the post into session variables. In the beginning of my php file i added: session_start() I then have: I also create another function for the purpose of checking the stored variables in session and checking if post_id is defined then i