May
14
2012

How to set up Custom Taxonomy and Custom Posts in WordPress? (part-1)



Wordpress make it easy to categorize your website content by the use of Custom Post Type UI Plugin. You create your own post types and categorize them by Custom Taxonomy. Download and install Custom Post Type UI Plugin in your WordPress site or blog.

After activating plugin, you will see Custom Post Type in left menu in wordpress site admin.

If you mouse over Custom Post types you will see Menu (Custom Post Types, Add New, Manage Post Types, and Manage Taxonomies). Click on Add New.

Enter Post Type Name, and click on Create Custom Post Type button. You can also set Advance label Options and Advance Options but if you don’t know them leave them as default.

I created custom post type name “Hotels”.

Enter Taxonomy Name; select your custom post type from Attach to Post Type checkbox options (In my case Hotels is custom post type) and Click on Create Custom Taxonomy button. You can also set Advance label Options and Advance Options but if you don’t know them leave them as default. I created Reservations as custom taxonomy.


Freelance Jobs

Apr
6
2012

Git commands


I like Git a lot. It is very much powerful then SVN. You can’t commit or merge if there are changes on same branch on server, this will prevent files to overwrite. See following statement.

To create branch, use following statement.

   $ git branch branchName

branchName is example in this post, you can give any name. If you run following command, you will see list of branches.

   $ git branch
  

Following is list of branches. branchName is that you created and the “master” branch is a default branch that was created for you automatically.

   $ git branch
     branchName
     *master
  

In above section * show current branch mean you are on master branch. To go on branchName , run following command.

$ git checkout branchName

Now make changes any git repository file. You can check changed files that you changed by following command.

$ git status

After this statement you will see file name with path where file exists. You must have to commit before switching branch, so that your changes can be save.

$ git commit  -am 'message'

Message can be any that remind you what changes you commit on any branch. Now checkout to master branch

$ git checkout master

Now you will see that your changes aren’t visible there. Merge branchName to master by following command

$ git merge branchName

If your changes don’t conflicts, then you are done. If there are conflicts then markers will be left in the problematic files showing the conflicts and you will also see file name with paths in which conflict have in git prompt. You can also use following statement to find difference in branches.

$ git diff

Following are marker that will come in the conflicted file.

<<<<<<< HEAD
Any statement
=======
Changes
>>>>>>> branchName

When you resolve conflicts you have to again commit these changes.

$ git commit  -am 'message'

Now your changes are merged.

More commands will be in next article


Mar
18
2012

How to remove button text in IE7?

Negative text-indent isn’t working in IE7 to remove button text but you can apply text-transform: capitalize with text-indent property.
Following is code snippet.

HTML code:

<input class="button" type="button" value="Button Text" />

CSS:

input.button { text-indent: -9999px; text-transform: capitalize; }


Feb
27
2012

How to change textbox value on blur() and focus() events in jquery?

Let following text field.

<input type='text' name="textbox" id="textbox" />

By following statement you can set its default value.

  $("#textbox").val("Any Value");

Use focus() event to change value when you focus on input field.

  $("#textbox").focus(function(){
         $("#textbox").val("");
 });
  

Use blur() event on textbox field.

  $("#textbox").blur(function(){
         $("#textbox").val("Any Value");
 });
  

Following is the code that I used on a website for search input text field.

		$('#s').focus(function(){
		  if($(this).val()=="Search...") {
		    $(this).val("");
		  }
		});
		$('#s').blur(function(){
		  if($(this).val()=="") {
		    $(this).val("Search...");
		  }
		});


Jan
22
2012

How to configure multi store in OpenCart?

Many of you might use opencart for online store development. Opencart can also be used for multi store with single admin; you can manage both stores with same admin.

I am using wamp so first I will tell you to configure multi stores with opencart on wamp.

I installed wamp in D drive and opencart directory path is D:\wamp\www\opencart. Main store url is http://localhost/opencart and I am going to make new store by the name of store.

  1. There is a file httpd.conf in wamp\bin\apache\Apache2.2.21\conf\. Open it and write following lines to create Alias for opencart new store.

    Alias \store “D:/wamp/www/opencart/”

    Note: Alias is pointing to same directory that is for my main store. It will be same for any other store too if you want to create.

    Now save file and restart Apache services.

  2. Now you have to change OpenCart configurations. Login to opencart admin then go System>Settings, create new store. You can give any name to the store and give Url http://localhost/store/.
  3. Now save your settings and you can access your both stores by http://locahost/opencart/ and http://localhsot/store/ urls.

You can create multi store on xamp too; just you need to make Alias in D:\xampp\apache\conf\httpd.conf file

Note: D is the drive where xamp is installed; your location might be different.

Have fun with multi store on opencart.


Nov
21
2011

“El is null” alert message in magento 1.5.1

When I tried to insert widget on cms page then there was error message el is null.


This is because of a forward slash is missing in lib/Varien/Data/Form/Element/Editor.php on line number 202.

Copy that Editor.php file in app/code/local/Lib/Varien/Data/Form/Element/

Replace following line

'onclick'   => "widgetTools.openDialog('" . $this->getConfig('widget_window_url') . "widget_target_id "

To

'onclick'   => "widgetTools.openDialog('" . $this->getConfig('widget_window_url') . "widget_target_id/"

After this change you can insert widget in cms.


Nov
16
2011

Images are not appearing in magento cms editor

I worked on a magento project on which cms images were not appearing in editor and also on front end.
CMS editor was getting image urls like http://your-websitelink.com/media//imagename.ext because of double slashes (//) images weren’t appear on front end as well as in cms editor.

I searched on internet but didn’t get any useful info that can solve this issue so I came up with a solution to use php functions to handle this.
Open file /httpdocs/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php
Change $url variable from

$url = Mage::getModel('core/email_template_filter')->filter($directive);

To

$url = substr_replace(Mage::getModel('core/email_template_filter')->filter($directive),"",strrpos(Mage::getModel('core/email_template_filter')->filter($directive),"/"),1);

Save it.

For front end I made static blocks for different images for different pages in left column those had same issue I fixed it same as above but used static block code as following.

$block = substr_replace($this->getLayout()->createBlock('cms/block')->setBlockId('block-name')->toHtml(),"",strrpos($this->getLayout()->createBlock('cms/block')->setBlockId('block-name')->toHtml(),"//"),1);
echo $block;

By above statements image url will not have double slashes.


Oct
28
2011

MS Access driver is not in odbc drives list in 64 bit Windows 7

Open your system’s control panel; then find and click on Administrative Tools
There will be new window opened. Right click on Data structures (ODBC), open properties.

Change value in Target as %windir%\syswow64\odbcad32.exe
And
Change value in Start in as %windir%\SysWOW64

Then save, it will work perfectly.


Oct
18
2011

How to remove index.php from CI URL?

  • Open <your_path>application/config/config.php file. Find following statement in this file.
    $config['index_page'] = ‘index.php’;
  • And remove index.php from above statement, this will look like following.
    $config['index_page'] = ”;
  • Create .htaccess file in application directory and paste following statements in it.
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
       #if you are working on localhost then above statement will be    RewriteBase /<your_path>
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?/$1 [L]
    </IfModule>
    
  • Make sure you have mod_rewrite is activated. If not; then visit How to activate mod_rewrite.

Oct
18
2011

How to activate mod_rewrite in apache?

  • Open apache configuration file i.e. httpd.conf
  • Find following statement.
    #LoadModule rewrite_module modules/mod_rewrite.so

  • You will find hash sign(#) in start of this statement, remove it.
  • Now restart apache services and enjoy search engine friendly urls.

Pages:1234»

Hire Me!

Bestselling Books

Amazon Search

Subscribe by Email

Ads