Browsing articles in "Wordpress"
Mar 28, 2016

[Resolved] WordPress update error

If you are getting below (or any WordPress update) error when you are updating your WordPress to latest version, the problem could be:

500 Internal Server Error

PHP Fatal error: Call to undefined function wp_oembed_add_host_js() in /var/www/production/blog/wp-admin/about.php on line 31

PHP version. Make sure the PHP version you have meets the required PHP version of new WordPress update.
Opcode cache. If you are using opcode cache like APC, clear the cache.
WordPress cache. Flush the WordPress cache (Wordfence, WP Super Cache, W3 Total Cache, etc.) you are using.
CloudFlare. If you are using external cache like CloudFlare, make sure you also flush it if you still see the above error.

Refresh the update page and see if this resolves for you!

Jun 27, 2013

WordPress plugin install without FTP

Wordpress Connection Information Error

WordPress generally gives you page to fill FTP connection details when you try to install new plugin or update wordpress. The reason is it cannot write to wp-content directory due of lack of permissions to write. The best way is to change permissions and ownership of wp-content directory. But if you can’t do that because of some reason, then add the below line of code in your wp-config.php

define('FS_METHOD', 'direct');

Other way is to change permissions and ownerships to wp-content directory as said.

chown -R www-data wordpress
chgrp -R www-data wordpress
chmod -R 755 wordpress/wp-content
Oct 22, 2012

WordPress: Show total/aggregate ratings and reviews to your posts/pages

After struggling for finding the way to show aggregate ratings and total number of reviews for the wordpress plugin WP Customer Reviews, I wrote it myself by studying their code. There has been several requests for this feature in their support page and around but they didn’t seem to be interested or didn’t got enough time to wrote this.

Okay, so for all the people who have been struggling to get total and/or aggregate number of ratings and reviews, here is the code that can work on any page/post.

global $wpdb;
$pId = $post->ID; //if using in another page, use the ID of the post/page you want to show ratings for.
$row = $wpdb->get_results("SELECT COUNT(*) AS `total`,AVG(review_rating) AS `aggregate_rating`,MAX(review_rating) AS `max_rating` FROM wp_wpcreviews WHERE `page_id`= $pId AND `status`=1");
$max_rating = $row[0]->max_rating;
$aggregate_rating = $row[0]->aggregate_rating; 
$total_reviews = $row[0]->total;
$totl = $aggregate_rating * 20;

Continue reading »

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!




Magento top 50 contributors

Magento top 50 contributors