Skip to content

Instantly share code, notes, and snippets.

@ivandoric
ivandoric / gist:e4e46294c4d35eac0ec8
Created June 5, 2014 11:17
wordpress: create custom reset password page
<?php //Add all of this tu custom page template ?>
<?php
global $wpdb;
$error = '';
$success = '';
// check if we're in reset form
if( isset( $_POST['action'] ) && 'reset' == $_POST['action'] )
{
@ivandoric
ivandoric / gist:358e0e4fbc2b05e67b06
Last active August 29, 2015 14:02
caroufredsel: jQuery example call
jQuery(".gallery-slider").carouFredSel({
items: 3,
circular: true,
responsive: true,
scroll : {
items : 3,
duration : 1500,
pauseOnHover : true
},
prev : {
@ivandoric
ivandoric / gist:cdb91e98a3d6821c6987
Last active August 29, 2015 14:01
magento: Update all prices by percent
--Check the attribute id for price first - in this case it's 75
update catalog_product_entity_decimal set value = (value*.05)+value where attribute_id=75
@ivandoric
ivandoric / category.php
Created May 20, 2014 10:32
wordpress: Check at what depth is the current category
<?php
//TEST AT WHAT DEPTH IS CURRENT CATEGORY
$max_depth_to_test = intval(3); //set this to highest depth you might have
$last_depth = 0;
$cat_to_test = $cat;
$category=get_category($cat_to_test);
for ( $counter = 1; $counter <= $max_depth_to_test; $counter += 1) {
if ($category->category_parent) {
$category=get_category($category->category_parent);
$last_depth = $counter;
@ivandoric
ivandoric / functions.php
Created April 30, 2014 17:44
wordpress: add class to prev/next posts links
//NEXT/PREV BLOG PAGE LINKS
add_filter('next_posts_link_attributes', 'posts_link_attributes_1');
add_filter('previous_posts_link_attributes', 'posts_link_attributes_2');
function posts_link_attributes_1() {
return 'class="next btn-gray"';
}
function posts_link_attributes_2() {
return 'class="prev btn-gray"';
@ivandoric
ivandoric / gist:11313711
Created April 26, 2014 07:02
sublime: Move to end of line
//Had to define this key in Key Bindings - User because it didn't have it defined on Mac OSX
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol", "extend": false} }
@ivandoric
ivandoric / gist:11253533
Created April 24, 2014 12:53
magento: Fishpig featured image size
<?php
getThumbnailImage()
getMediumImage()
getLargeImage()
getFullSizeImage()
getPostThumbnailImage()
getAvailableImage()
getImageByType($type = 'thumbnail')
@ivandoric
ivandoric / gistwpconf
Last active November 15, 2017 06:36
wordpress: plugin installation on more protected servers
//Add at the end of wp-config.php file
if(is_admin()) {
add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
define( 'FS_CHMOD_DIR', 0751 );
}
@ivandoric
ivandoric / gist:11220813
Created April 23, 2014 15:49
drupal: Print custom menu links
/*Print custom menu links*/
<?php print theme('links', menu_navigation_links('menu-MENU-NAME'), array('id' => 'menu', 'class' => 'links')); ?>
@ivandoric
ivandoric / gist:11220757
Created April 23, 2014 15:47
wordpress: Remove styling for WP gallery
<?php
add_filter('gallery_style',
create_function(
'$css',
'return preg_replace("#<style type=\'text/css\'>(.*?)</style>#s", "", $css);'
)
);