Skip to content

Instantly share code, notes, and snippets.

View cristianstan's full-sized avatar
🎯
Focusing

Cristian Stan cristianstan

🎯
Focusing
View GitHub Profile
@cristianstan
cristianstan / Wordpress: Get theme directory.php
Created February 28, 2014 08:49
Wordpress: Get theme directory
<?php //Wordpress: Get theme directory.php ?>
<?php echo get_template_directory_uri(); ?>
How to use:
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/images/favicon.ico" />
@cristianstan
cristianstan / MySql: Change mysql user password using ssh.sql
Created February 28, 2014 21:22
MySql: Change mysql user password using ssh
// That should start up mysql without the need for a root password. Once in, type
use mysql
UPDATE mysql.user SET password=PASSWORD('newpass') WHERE user='root';
FLUSH PRIVILEGES;
exit
@cristianstan
cristianstan / Magento: Remove all products.sql
Created March 3, 2014 11:27
Magento: Remove all products
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_product_bundle_option`;
TRUNCATE TABLE `catalog_product_bundle_option_value`;
TRUNCATE TABLE `catalog_product_bundle_selection`;
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`;
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
@cristianstan
cristianstan / Magento: Import Bulk Categories
Created March 3, 2014 11:29
Magento: Import Bulk Categories
There is a requirement of my client to import bulk category, So to solve this we created this export import extension.
To install this download extension from link below unzip files paste both app and skin folder to your magento folder its will ask for over writing click ok, clear your var/cache folder login to your admin panel on top you will see MageWorks category import/export options
=========EXTENSION=============
SOURCE: http://www.magentoworks.net/importexport-magento-category-extension
@cristianstan
cristianstan / CSS: Responsive intervals v2.css
Created March 13, 2014 14:19
CSS: Responsive intervals v2
/* ### Responsive Max_319px ### */
@media only screen and (max-width: 319px) {
@cristianstan
cristianstan / Wordpress: Show post date time ago days ago.php
Created April 10, 2014 14:08
Wordpress: Show post date time ago/ days ago
<?php
// add this within functions.php
function comments_time_ago( $type = 'comment' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');
}
//to show comment time
@cristianstan
cristianstan / Wordpress: Get author meta.php
Created April 12, 2014 09:58
Wordpress: Get author meta
<?php
//GET AUTHOR ID
$authorID = get_the_author_meta('ID');
// GET "fax" meta
echo get_the_author_meta('fax', $authorID, true); ?>
or
the_author_meta('fax');
>
@cristianstan
cristianstan / Wordpress: Frontend user edit profile
Created May 15, 2014 13:18
Wordpress: Frontend user edit profile
SOURCE: http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end
@cristianstan
cristianstan / Magento: Get number of items in cart.php
Created May 16, 2014 22:21
Magento: Get number of items in cart
<?php
//Get number of items in cart
$totalItemsInCart = Mage::helper('checkout/cart')->getItemsCount();
?>
@cristianstan
cristianstan / Magento: If customer is logged in.php
Created May 16, 2014 22:23
Magento: If customer is logged in
<?php
$this->helper('customer')->isLoggedIn()
?>