Skip to content

Instantly share code, notes, and snippets.

View drinkmaker's full-sized avatar
🏠
Working from home

Alexander Khmelnitskiy drinkmaker

🏠
Working from home
View GitHub Profile
@drinkmaker
drinkmaker / theme.php
Created November 24, 2015 11:04
theme.php
<?php
/**
* Torbara Maxx-Fitness Theme for WordPress, exclusively on Envato Market: http://themeforest.net/user/torbara
* @encoding UTF-8
* @version 1.0
* @copyright Copyright (C) 2015 Torbara (http://torbara.com). All rights reserved.
* @license GNU General Public License version 2 or later, see http://www.gnu.org/licenses/gpl-2.0.html
* @author Alexandr Khmelnytsky (support@torbara.com)
*/
@drinkmaker
drinkmaker / widget-file.php
Created November 26, 2015 18:17
widget-file.php
<?php
// Add plugin settings
$Plugin_Name = plugin_basename( __FILE__ );
add_filter( "plugin_action_links_$Plugin_Name", 'tt_Add_Settings_Links_For_Plugin' );
if ( !function_exists('tt_Add_Settings_Links_For_Plugin') ) {
function tt_Add_Settings_Links_For_Plugin($links) {
array_push($links, '<a title="We are developing beautiful themes and applications for the web!" href="http://torbara.com" target="_blank" style="font-weight: bold; font-size: 14px;"><img src="http://www.googledrive.com/host/0Bxtm5PidFyMoN3VhYWlfVU45MXc" alt="" style="width: 24px; vertical-align: middle; position: relative; top: -1px;"> Torbara.com</a>');
array_push($links, '<a title="Our portfolio on Envato Market" href="http://themeforest.net/user/torbara/portfolio?ref=torbara" target="_blank"><img src="http://www.googledrive.com/host/0Bxtm5PidFyModml3aXJ0T3hFQ2M" alt="" style="width: 16px; vertical-align: middle; position: relative; top: -2px;"> Envato</a>');
@drinkmaker
drinkmaker / price.html
Created December 6, 2015 12:17
Price 3 columns
<div class="uk-grid tm-price" data-uk-grid-margin="" data-uk-grid-match="{target:'.uk-panel'}">
<div class="uk-width-medium-1-3 uk-text-center" data-uk-scrollspy="{cls:'uk-animation-slide-left', repeat: true}">
<div class="uk-panel">
<div class="price">$24<sup>.99</sup></div>
<h2 class="uk-panel-title uk-margin-top">per month</h2>
<p class="tm-panel-subtitle">Health Checks <br>Personal fitness programm <br>Membership cards</p>
<a class="uk-button uk-button-large" href="#" title="Buy Now">
<i class="uk-icon-akplus">+</i>
<span>Buy Now</span>
@drinkmaker
drinkmaker / loaction.html
Created December 22, 2015 07:49
MaxxFitness WP location slide
<img src="/wp-content/uploads/demo/visuals/slide-contacts.jpg" width="800" height="400" alt="Contacts - Slide">
<div class="uk-overlay-panel uk-flex uk-flex-center uk-flex-bottom tm-contacts">
<div>
<div class="uk-grid">
<div class="uk-width-medium-1-2 uk-width-large-1-4">
<h5 class="tm-uppercase uk-position-relative">
<i class="tm-circle">1</i>
Central Fitness Club
</h5>
@drinkmaker
drinkmaker / comments.html
Created March 21, 2016 07:58
Подпись с банером Эста
<p><a href="http://support.torbara.com"><img src="http://www.googledrive.com/host/0Bxtm5PidFyMoMnVUN2t5ME45dVE"></a><a href="http://themeforest.net/item/esta-responsive-real-estate-wordpress-theme/14292309"><img src="http://www.googledrive.com/host/0Bxtm5PidFyMoUGNqZ3hwTXlGaWc"></a></p>
@drinkmaker
drinkmaker / functions.php
Created July 20, 2016 08:51
stop wp removing some html tags in editor (So stupid feature)
<?php
// stop wp removing some html tags in editor (So stupid feature)
function esta_tinymce_fix($init) {
// html elements being stripped
$init['extended_valid_elements'] = 'div[*], article[*], span[*], strong[*], pre[*], h1[*], h2[*], h3[*], h4[*], h5[*], h6[*], b[*], i[*], tt[*], em[*], font[*], a[*], p[*], br[*], blockquote[*], dt[*], dd[*], ol[*], li[*], ul[*], li[*], img[*], hr[*], form[*], select[*], option[*], textarea[*] input[*], table[*], tr[*], td[*], th[*]';
// don't remove line breaks
$init['remove_linebreaks'] = false;
<?php
global $wp_embed;
$video_url = 'https://www.youtube.com/watch?v=b7mixrO2lzA';
echo $wp_embed->run_shortcode( '[embed]' . $video_url . '[/embed]' );
@drinkmaker
drinkmaker / str_truncate.php
Created July 19, 2019 08:02
A PHP function to truncate a string either it contains HTML or not
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
* @param string $ending Ending to be appended to the trimmed string.
* @param boolean $exact If true, $text will not be cut mid-word
@drinkmaker
drinkmaker / junction.html
Last active January 24, 2020 17:55
Junction Example
Hey guys, check out the
<a href="https://alexander.khmelnitskiy.ua/evil-hacker/" target="_blank">latest post</a>
in the blog of my buddy.
@drinkmaker
drinkmaker / wp-get-widget-instance.php
Created February 3, 2020 15:20 — forked from cyberhobo/wp-get-widget-instance.php
Get a WordPress registered widget instance settings.
<?php
function get_widget_instance( $widget_id ) {
global $wp_registered_widgets;
if ( empty( $wp_registered_widgets[$widget_id]['callback'] ) )
return array();
/** @var WP_Widget $widget */
$widget = $wp_registered_widgets[$widget_id]['callback'][0];