Skip to content

Instantly share code, notes, and snippets.

@anestan
anestan / woo-subcat-count.php
Created February 13, 2017 15:52
Modify product category count
add_filter('woocommerce_subcategory_count_html', 'my_subcategory_filter', 10, 2);
function my_subcategory_filter($markup, $category) {
return '<div class="my_new_class">' . $category->count . ' subcategories</div>';
}
@anestan
anestan / admin-testimonials.js
Created January 26, 2017 12:18 — forked from tomazzaman/admin-testimonials.js
How to create a testimonial widget with Backbone
var myWidgets = myWidgets || {};
// Model for a single testimonial
myWidgets.Testimonial = Backbone.Model.extend({
defaults: { 'quote': '', 'author': '' }
});
// Single view, responsible for rendering and manipulation of each single testimonial
myWidgets.TestimonialView = Backbone.View.extend( {
@anestan
anestan / CLI.sh
Created January 26, 2017 06:04 — forked from rezzz-dev/CLI.sh
PHP Code Sniffer with WordPress Coding Standards and Atom
#Install PHP CodeSniffer
brew install homebrew/php/php-code-sniffer #if using Homebrew
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs #if you want to do it directly
#Install WordPress Coding Standards
git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
#Add WordPress standards to PHPCS config
phpcs -i #shows the libraries installed
phpcs --config-set installed_paths <path to dir that you cloned>/wpcs
@anestan
anestan / youtube.css
Created January 11, 2017 14:52
Make youtube fullscreen for iframe
https://codepen.io/cvn/pen/WbXEoX/
@anestan
anestan / remove_p_from_images.php
Created November 30, 2016 08:19
Remove P Tags From Images - Wordpress
function filter_ptags_on_images($content) {
$content = preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
return preg_replace('/<p>\s*(<iframe .*>*.<\/iframe>)\s*<\/p>/iU', '\1', $content);
}
add_filter('the_content', 'filter_ptags_on_images');
@anestan
anestan / pretty_var_dump.php
Last active October 17, 2016 09:14
pretty var_dump
highlight_string("<?php\n\$data =\n" . var_export($variable, true) . ";\n?>");
@anestan
anestan / apply_filters.php
Last active August 2, 2016 12:38
wp - apply_filters()
<?php
//in theme file
echo apply_filters('prefix_advertisement_text', 'advertisement');
//add this in child theme function to change it
function prefix_myad_text() {
return 'MY CUSTOM TEXT';
}
add_filter('prefix_advertisement_text','prefix_myad_text');
@anestan
anestan / mixins.scss
Created April 18, 2016 14:17 — forked from AlexPashley/mixins.scss
SASS: Mixins for CSS
/* MIXINs */
@mixin transition( $val : ease 0.5s ) {
-webkit-transition: $val;
-moz-transition:$val;
-o-transition:$val;
-ms-transition:$val;
transition:$val;
}
@mixin text-shadow( $top: 3px, $left: 3px, $blur: 3px , $colour: #333 ) {
@anestan
anestan / footer.php
Created October 10, 2015 06:06
icelock - modify footer with polylang
@anestan
anestan / homepage.php
Created October 10, 2015 06:04
icelock - modify homepage with polylang
<!-- PORTFOLIO SECTION -->
<h2>
<?php
if ( function_exists('pll_register_string') ) {
echo pll__(get_theme_mod('icelock_title_portfolio_section'));
} else {
echo get_theme_mod('icelock_title_portfolio_section');
}
?>