Skip to content

Tag: wordpress

Programmatically inserting a widget into WordPress sidebar

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,…

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

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

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

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…

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/ve…