Get Feature Image

The following code you can use for get the feature image of post in wordpress.

   //Example 1
   $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
   echo '$feat_image';

 //Example 2
   $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(145), 'large');
   echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >';
   echo get_the_post_thumbnail($post->ID, 'thumbnail');
   echo '</a>';
Posted in Wordpress | Leave a comment

Wordperss:get blog url and template url

If you want to get the URL of an blog, theme url , call one of this functions adding your own path at the end. Below every function there is an example of the output value:

//For Blog URL
bloginfo('url');

//For theme folder URL
bloginfo('template_url')
Posted in Wordpress | Leave a comment

Add Static Block to CMS Page

There is definitely nothing complicated about doing this. Static blocks are a great way to divide up different types of data blocks to make updating content easier.

There are just two simple steps to adding a static block to a cms page. First, create your static block. You will use the identifier to call it on the cms page. Let’s say, for this example, we call the identifier “home-page-promo”.

Once your static block is created, edit whatever cms page you would like this block to appear on, and simply put this code in right where you want it to show up:

{{block type=”cms/block” block_id=”home-page-promo”}}

Posted in Magento | Leave a comment

Get Magento Base URL

If you want to get the source url of an image, javascript or file, call one of this functions adding your own path at the end.

Below every function there is an example of the output value:

http://noshouse.com/


< ?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB); ?>

http://noshouse.com/js/


< ?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS); ?>

http://noshouse.com/index.php/


< ?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK); ?>

http://noshouse.com/media/


< ?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>

http://noshouse.com/skin/


< ?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>
Posted in Magento | Leave a comment