WordPress issue : Could not create upgrade directory

Today I got strange issue while update wordpress site. This gave me error like this “Could not create upgrade directory”.

Firstly I thought this was the issue of directory permission so I did set upgrade directory 777 mode but I was unsuccessful. Then tried to delete upgrade folder and created new one, for me that was still issue. Then I read the some articles on WordPress codex and this trick(delete and create upgrade directory) works for many people. But in the mine case this was not work. I started think about this issue and found the issue with ask apache module. This module was not giving permission to write anything on the directory.

Finally I deactivate ask apache module and upgrade my WordPress version as well as plugin and again I activated this plugin for security purposes. This technique worked for me very well.

Hope this method will work for other people.

Increase PHP’s File Upload Limit Using .htaccess file

How do we increase upload file limit through .htaccess file. Here I am giving you quick trick.

Create .htaccess file(If you have already .htaccess file on the server then no need to create it just update that file) using your favorite text editor like notepad++ and put below code on that file :

php_value memory_limit 256M
php_value upload_max_filesize 50M
php_value post_max_size 50M

If you want to also increase the php script execution time then put this code in the .htaccess file

php_value max_execution_time 18000

The values 256M,50M and 18000 you can change as per your requirement.

How to include JQuery on your WordPress theme

WordPress comes with JQuery (It is used in the dashboard) so you don’t need to download a new copy of JQuery to your WordPress server.
For accessing JQuery on WordPress site, you need to paste below code on your header.php file within the and tags:

When you will add this JQuery automatically will be called in the website.

That’s all!!

Javascript Confirm Delete

How to use a javascript confirm box to ask the user if they want to delete

<script>
function confirmDelete(deleleteUrl) {
if (confirm(“Are you sure you want to delete”)) {
document.location = deleleteUrl;
}
}
</script>

<a href=”javascript:confirmDelete(‘delete.php?id=1’)”>Delete</a>

Another way

<a href=”delete.php?id=1″ onclick=”return confirm(‘Are you sure you want to delete?’)”>Delete</a>

How to add .SWF files to the html webpage

Here I am sharing flash code for embedding flash in the website. Hope this will help many more….

<object width=”400″ height=”220″ align=”middle” classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs
/flash/swflash.cab#version=7,0,0,0″ id=”player1″>
<param value=”your_flash_file.swf” name=”movie”>
<param name=”menu” value=”false”>
<param name=”quality” value=”high”>
<param name=”wmode” value=”transparent”>
<param name=”bgcolor” value=”#FFFFFF”>
<embed width=”400″ height=”220″ align=”middle” src=”your_flash_file.swf” menu=”false” quality=”high” bgcolor=”#FFFFFF” name=”player” wmode=”transparent” allowtransparency=”true” allowscriptaccess=”always” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer”>
</object>

If you want to change any attribute then you can take reference from adobe site. Here is the link :

Flash OBJECT and EMBED tag attributes

Web browser css hacks – firefox, IE, chrome, safri, Opera

Inline Hack for IE
* (star) can be used as the inline hack for both ie6 and ie7.

For Example:
Syntax: .selector{*property:value;}
.logo{*margin-left:10px;}

IE6 browser inline Hack
_ (underscore) can be using only for ie6

For Example:
Syntax: .selector{_property:value;}
.logo{_margin-left:10px;}

Firefox inline style
content:””/*” can be used for firefox only where IE cannot recognize it.

Internal Style
Use * html for ie6 and *+html hack for ie7

For Example:
Synatax: * html .selector{property:value;} , * + html .selector{property:value;}

* html .logo{margin-left:10px;} for ie6
* + html .logo{margin-left:20px;} for ie7

IE7 and Firefox browser Hack
Use html>body hack for ie7 and firefox.

For Example:
Syntax: html>body .selector{property:value;}

html>body .logo{margin-left:10px} will take only in ie7 and firefox

Mordern browser Hack or Firefox Hack
Use html>/**/body {} hack which will support only in both firefox2 and firefox3.

For Example:
Syntax: html>/**/body .selector{property:value;}

html>/**/body .logo{margin-left:10px} will take only in firefox.

Browser hack for Opera versions 9 and below
Use html:first-child {} for opera browser. Also you use
Syntax: @media all and (min-width:0px) {head~body .selector {property:value;}}

For Example:
@media all and (min-width:0px) {head~body .logo {margin-left:10px;}} only for opera

Firefox3 browser hack
Use html>/**/body .selector, x:-moz-any-link, x:default {property:value;} for firfox3 only.

For Example:
Syntax: html>/**/body .pro_yl, x:-moz-any-link, x:default {background:red;}

Google Chrome browser hack
Use body:nth-of-type(1) .elementOrClassName{property:value;} only for google chrome.

For Example:
body:nth-of-type(1) .logo{margin:20px;}

Safari browser hack
Use Syntax: body:first-of-type .elementOrClassName{property:value;}

Fox Example:
body:first-of-type .logo{margin-top:10px;} only for safari.

Fascinating problem with .htaccess and addon domain

Recently I got website project from my client and he was interested to do install the site on addon domain. I installed the site successfully but were not to able to update the website content from admin panel. There was an issue of restriction and/or permission in the root domain’s .htaccess. So I thought I can solve this issue by using overriding the .htaccess file using this code

AllowOverride None

But this was not working for me. Again I thought what will be the issue why this is not working. I finally got the solution for this issue.

Our root .htaccess file were using rewrite rules.

Here’s what worked:
#enable rewrite engine
RewriteEngine on

.htaccess file in addon path (/public_html/cragsem.com/addon.com/) looks like this:

RewriteEngine off

Hope this post will help for others..

Display banners for category page in Magento

Display banners for category page is very easy in magento. This banner will be shown at the top in middle column. It’s very easy functionality provided by magento itself. You just need to know how to do this that all. Lets walk through the set of 2 quick and easy steps. Presuming that you have magento installed along with sample data/ or using default them. If in case the custom theme is installed/ configured then you may need to check the new theme file i.e. view.phtml of category page.

2 quick and easy steps:

Step 1: Create static block.
Login to the magento admin panel and click on “CMS > Static blocks” and create new static block.
Just remember the name of static block here

Step 2: Assign static block to the category.
Once the step 1 is complete go to the “Catalog > Manage Categories”. Select/ Click the category from left menu. It will reload the right hand panel data. Select “Display Settings” tab from right hand panel.
Now change
I) “Display Mode” drop down value “product only” to “static block and prodcut”.
II) Now select the cms block from drop down list of “CMS Block” field and click on save category button.

Now go to front-end and select the category page for whom you have just set the cms block. It will show you banner at the top of product list.

How to move Magento website to another domain in the same server

There’s a few things you need to do once you have your staging domain name all set up.

1. Copy the database. Export it to a file, create a staging database, Open exported database file with any well know editor(like notepad++) and replace current domain “currentdomain.com” to new domain “newdomain.com” and import this dump file.
2. Copy the files to new domain folder. Make sure you clear the var/cache and var/session folders as they’ll have old data that we don’t need.
3. Update the app/etc/local.xml file with your new staging database information. This step is important!
5. Finally, load up the staging domain, and that should about do it!

If you need any help then contact us

Enjoy!!!!

How to set Google Analytics in Magento Store

Google Analytics is a free Google service which allows the webmasters and web site administrators to monitor their web sites’ traffic and conversion ratio.

Magento supports two types of tracking:

1-Page View Tracking: Lists the origin from which your web store visitors linked to your store.

2-E-commerce Tracking: Lists the customers that make purchases and what they buy.

First you need to sign up at http://www.google.com/analytics/sign_up.html. You will receive a Google Analytics account number. Write it down since you will need it for the Magento configuration.

Then configure the Google Analytics tracking in Magento. Open the Magento Admin area and navigate to System->Configuration->Sales->Google API.

Pick the Yes option from the Enable drop-down menu. Enter the Google Analytics account number in the Account number field. Click on the Save Config button.

That’s all.

Enjoy!!