Category Archives: Wordpress Customization

WordPress in AWS micro istance

I am currently running this wordpress blog in AWS micro instance to see how it goes.

I find some issues.

Atelease once in a week I can not connect to phpmyadmin using master password.

When I check the phpmyadmin folder I see that does not contain password or anything.

Added them back and fixed the issue.

Another issue I find is I can not restart mysql server.

It gives the following error

Stopping mysqld: [ OK ]
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

I have restarted the EC2 instance, then restrated apache and mysql, everything is back.

It looks like the MySQL database crashed because the micro EC2 instance that I was using didn’t have enough processing power to handle the wordpress queries. This is a basic wordpress blog without much plugins, so looks like micro instance is not good enough to run wordpress.

dsIDXpress not functioning properly in Thesis 2

dsIDXpress is a plugin for wordpress that gives IDX functionality to wordpress based site.

It allows visitors to search and browse available properties in your MLS.

Search engine will index properties from MLS on the website.

dsIDXpress works with Thesis 1.x series, but recently did a site on Thesis 2. Widgets, shortcodes etc will work without any issues.

But the page that displays the details of single property is not working. It just shows the contents of home page.

dsIDXpress is not recognizing any templates in Thesis 2.

Hope the plugin developer and thesis theme developer share their knowledge and figure out a fix / solution.

How to allow users to post only in some categories: wordpress

The following code will be useful if you want to allow users to post only in some categories.

function restrict_categories($categories) { 
// If we are in the new/edit post page and not an admin, then restrict the categories
$onPostPage = (strpos($_SERVER['PHP_SELF'], 'post.php') || strpos($_SERVER['PHP_SELF'], 'post-new.php'));
if (is_admin() && $onPostPage && !current_user_can('level_10')) {
$size = count($categories);
for ($i = 0; $i < $size; $i++) {			 			if ($categories[$i]->slug != 'user-created-articles' && $categories[$i]->slug != 'user-created-content' && $categories[$i]->slug != 'user-created-disagreements'&& $categories[$i]->slug != 'user-created-reviews')
return $categories;
add_filter('get_terms', 'restrict_categories');

In the above code it checks the category slug. Admin can post in any categories, but other users can post only in the categories, where slug is either “user-created-articles” or “user-created-articles” or “user-created-disagreements” or “user-created-reviews”

Permit contributors to upload images in wordpress

By adding the following code to functions.php in your theme file you can permit contributors to upload images.

if ( current_user_can('contributor') && !current_user_can('upload_files') )
	add_action('admin_init', 'allow_contributor_uploads');

function allow_contributor_uploads() {
	$contributor = get_role('contributor');