Skip to content

Instantly share code, notes, and snippets.

View proweb's full-sized avatar

Sergey Mochalov proweb

View GitHub Profile
@proweb
proweb / d7_function.php
Created May 9, 2017 11:07
Drupal 7 - remove shortlink, rel=alternate and generator meta tag
function themename_html_head_alter(&$head_elements) {
foreach ($head_elements as $key => $element) {
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'shortlink') {
unset($head_elements[$key]);
}
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'alternate') {
unset($head_elements[$key]);
}
}
unset($head_elements['system_meta_generator']);
@proweb
proweb / equalheightslick.js
Created May 6, 2017 16:30
Slick carousel equal height slides
$(window).load(function() {
$('.slides').on('setPosition', function () {
$(this).find('.slick-slide').height('auto');
var slickTrack = $(this).find('.slick-track');
var slickTrackHeight = $(slickTrack).height();
$(this).find('.slick-slide').css('height', slickTrackHeight + 'px');
});
})
@proweb
proweb / slick_fix.css
Created May 6, 2017 16:23
Css fix for slick carousel in bootstrap 3 tab
/* Based on https://github.com/kenwheeler/slick/issues/187#issuecomment-59123524 */
/* bootstrap hack: fix content width inside hidden tabs */
.tab-content > .tab-pane,
.pill-content > .pill-pane {
display: block; /* undo display:none */
height: 0; /* height:0 is also invisible */
overflow: hidden; /* no-overflow */
}
.tab-content > .active,
.pill-content > .active {
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20160309
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@proweb
proweb / post_format_icon.php
Created February 15, 2017 11:20 — forked from smutek/post_format_icon.php
Function for Post Format icons
<?php
/**
* Output Post Format icons
*
* Outputs an icon for each post format. Set up to use Fontawesome,
* but can be used with anything, or you can just use CSS.
*
* @return string
*/
function post_format_icon() {
@proweb
proweb / modificator.xml
Created December 20, 2016 15:34
Модифицируем заголовок модуля Рекомендуемые (Featured) в Opencart. Заголовок берется из настроек самого модуля
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Featured module name replace</name>
<code>featuredmodulenamebyagatha65</code>
<version>1.0</version>
<author>agatha65.com</author>
<link>http://agatha65.com/services/opencart-extensions</link>
<file path="catalog/controller/extension/module/featured.php">
<operation>
@proweb
proweb / category.php
Created July 24, 2016 17:19
JBZOO category template (/media/zoo/applications/jbuniversal/templates/uikit/category.php)
if (isset($category)) {
$cat_name = $category->name;
$cat_alias = $category->alias;
$cat_description = $category->description;
$cat_alter_name = $category->params->get('content.category_title');
$cat_subtitle = $category->params->get('content.category_subtitle');
$cat_teasertext = $category->params->get('content.category_teaser_text');
}
@proweb
proweb / functions.php
Last active May 7, 2017 03:35
Wordpress. Function for remove archive prefix from archive title. Remove “Category:”, “Tag:”, “Author:” from the_archive_title.
function remove_category_prefix_from_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
@proweb
proweb / gist:6c6100434e67aaa64ced
Created January 2, 2016 21:46 — forked from johnbillion/hierarchy.php
WordPress Template Hierarchy (as of WordPress 4.4)
<?php
/* WordPress Template Hierarchy as of WordPress 4.4
is_404() ---------------------------------------------------------------------------------------------------> 404.php
is_search() ------------------------------------------------------------------------------------------------> search.php
is_front_page() --------------------------------------------------------------------------------------------> front-page.php
is_home() --------------------------------------------------------------------------------------------------> home.php
@proweb
proweb / default.vcl
Created November 4, 2015 15:40 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla (& other CMS based) websites
#################################################################################
### The perfect Varnish configuration for Joomla (& other CMS based) websites ###
#################################################################################
# USE: Place the contents of this configuration inside the main
# Varnish configuration file, located in: /etc/varnish/default.vcl (root server access required - obviously)
# IMPORTANT: The following setup assumes a 2 minute cache time. You can safely increase
# this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.