Skip to content

Instantly share code, notes, and snippets.

@asifsomy
asifsomy / functions.php
Last active August 29, 2015 14:27 — forked from redesigned/functions.php
Wordpress Magento Cross Integration
/* ===================================== */
/* Add This to Wordpress's /wp-content/yourtheme/functions.php file */
define('MAGENTO_ROOT', '/Volumes/Storage/www/heartandsun/store/');
define('MAGENTO_LOADER', MAGENTO_ROOT.'app/Mage.php');
if (!class_exists('Mage')) {
require_once(MAGENTO_LOADER);
umask(0);
Mage::app("default");
};
/* ===================================== */
@asifsomy
asifsomy / WrapDivs.php
Last active January 6, 2016 13:15
Wrap n number of divs into a parent div
<?php
$i=0;
$wrap_count = 4; // you can change this no of divs to wrap
foreach ($categories as $category)
{
$i+=1;
if($i%$wrap_count==1)
echo '<div class="row">';
?>
<div class="col-lg-3 col-md-3">.....</div>
@asifsomy
asifsomy / functions.php
Last active January 6, 2016 13:17
Remove Unwanted Archive URLs
function cd_remove_unwanted_archives(){
if( is_search() || is_category() || is_tag() || is_date() || is_author() ) {
global $wp_query;
$wp_query->set_404();
}
}
add_action('template_redirect', 'cd_remove_unwanted_archives');
@asifsomy
asifsomy / addCats.php
Last active January 28, 2016 19:33
Create Bulk Magento Categories
<?php
$cats = array(
'Name' => 'Description.',
);
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
@asifsomy
asifsomy / .htaccess
Created April 4, 2017 18:36
Wordpress: Pull remote images while working in localhost
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /SITENAME.com/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} ^127\.0\.0\.1$
RewriteRule ^wp-content/uploads/(.*)$ http://SITENAME.com/wp-content/uploads/$1 [NC,L]
</IfModule>
@asifsomy
asifsomy / wpcf-form-triggers.css
Last active February 10, 2018 06:23
Contact from 7 On Submit, Invalid, Spam, MailSent, Mail Failed JS triggers
div.wpcf7 img.ajax-loader{display:none; margin:5px auto 0;}
@asifsomy
asifsomy / default-wordpress-blocks-sass.scss
Created August 31, 2020 15:17 — forked from davewarfel/default-wordpress-blocks-sass.scss
WordPress Blocks Styles - Cleaned Up, Commented & Sassified
/**
* WordPress Blocks
*
* Default block styling included with WordPress core.
* Provides a better starting point for WordPress theme developers,
* especially when using Sass.
*
* @link https://github.com/WordPress/WordPress/blob/master/wp-includes/css/dist/block-library/style.css
*
* Most styles from the above file are included.