keithg

add Text box in setting page – wordpress

Add code in function.php add_filter(‘admin_init’, ‘fbfn’); function fbfn() { register_setting(‘general’, ‘fb_id’, ‘esc_attr’); add_settings_field(‘fb_id’,”.__(‘Become a fan ‘ , ‘fb_id’ ).” , ‘fb_html’, ‘general’); } function fb_html() { $fb = get_option( ‘fb_id’, ” ); echo “<input type=’text’ id=’fb_id’ name=’fb_id’ value='”.$fb.”‘ >”; }  Read more …
keithg

inline javascript and css using hook – wordpress

add_action( ‘wp_head’, ‘print_my_custom_scripts’ ); function print_my_custom_scripts() { print ‘<script type=”text/javascript”>jQuery(document).ready(function() { alert(‘WordPress’)   });</script>’; print ‘<style type=”text/css”>.align{margin-left:32px;}</style>’; }Read more …
keithg

hide pages from page list

add_filter( ‘parse_query’, ‘exclude_pages_from_admin’ ); function exclude_pages_from_admin($query) { global $pagenow,$post_type; if (is_admin() && $pagenow==’edit.php’ && $post_type ==’page’) { $query->query_vars[‘post__not_in’] = array(‘156′,’157′,’167′,’159′,’74’,’158′,’160′,’161′,’169′,’71’); } }Read more …
keithg

add new attribute value to product query in magento

We have taken sale attribute to product general tab. $_productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘sale’, array(‘eq’ => ‘1’)) ->addMinimalPrice() ->addUrlRewrite() ->addTaxPercents() ->addStoreFilter() ->addFieldToFilter(‘visibility’, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH) ->addFieldToFilter(‘status’, Mage_Catalog_Model_Product_Status::STATUS_ENABLED);     Today s special price query $todayDate = Mage::app()->getLocale()->date()->toString(Varien_Date::DATETIME_INTERNAL_FORMAT); $_productCollection = Mage::getResourceModel(‘catalog/product_collection’) ->addAttributeToSelect(‘*’) ->addAttributeToFilter(‘special_price’, array(‘neq’=>”)) ->addAttributeToFilter(‘special_from_date’, array(‘date’ => true, ‘to’ => $todayDate)) ->addAttributeToFilter(‘special_to_date’, array(‘or’=>...Read more …
keithg

Add india timezone in magento

you have to set your timezone manually first go to app/etc/config.xml add your time zone here <general> <locale> <code>en_US</code> <timezone>Asia/Calcutta</timezone> </locale> </general> second go to app/Mage.php on line 768 change this line too date_default_timezone_set(‘UTC’); to your timezone date_default_timezone_set(‘Asia/Calcutta’); ================================================================================= To check Time zone Mage::getModel(‘core/date’)->gmtDate(‘Y-m-d H:i:s’)Read more …