Skip to content

Instantly share code, notes, and snippets.

View KingYes's full-sized avatar

Yakir Sitbon KingYes

View GitHub Profile
@KingYes
KingYes / wma-to-mp3.sh
Created March 11, 2014 05:45
WMA to MP3 Coverctor.
#!/bin/bash
current_directory=$( pwd )
#remove spaces
for i in *.wma; do mv "$i" `echo $i | tr ' ' '_'`; done
#Rip with Mplayer / encode with LAME
for i in *.wma ; do mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader "$i" && lame --vbr-new -V4 -m s audiodump.wav -o "$i"; done
@KingYes
KingYes / add-custom-widget-in-pojo-page-builder.php
Created April 18, 2014 07:18
Simple code for add custom Widget to Page Builder by Pojo
<?php
function add_social_widget_to_page_builder( $widgets ) {
$widgets[] = 'Pojo_Widget_Social_Links';
return $widgets;
}
add_filter( 'pb_page_builder_widgets', 'add_social_widget_to_page_builder' );
@KingYes
KingYes / wordpress-favicon.php
Created June 8, 2014 10:29
WordPress Favicon
<?php
function pojo1029_show_favicon() {
?>
<link rel="apple-touch-icon" sizes="57x57" href="http://www.example.com/apple_touch_icon_iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="http://www.example.com/apple_touch_icon_ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="http://www.example.com/apple_touch_icon_iphone_retina.png" />
<link rel="apple-touch-icon" sizes="144x144" href="http://www.example.com/apple_touch_icon_ipad_retina.png" />
<?php
}
add_action( 'wp_head', 'pojo1029_show_favicon' );
@KingYes
KingYes / functions.php
Last active August 29, 2015 14:05
Add sidebar area after WP Content
<?php
function pojo4321_add_sidebar_area( $content ) {
ob_start();
dynamic_sidebar( 'YOUR SIDEBAR AREA NAME' );
$content .= ob_get_clean();
return $content;
}
add_filter( 'the_content', 'pojo4321_add_sidebar_area', 9999 );
@KingYes
KingYes / .htaccess
Created September 10, 2014 20:06
Simple Apache conf caches
# ------------------------------------------------------------------------------
# | Proper MIME types for all files |
# ------------------------------------------------------------------------------
<IfModule mod_mime.c>
# Audio
AddType audio/mp4 m4a f4a f4b
AddType audio/ogg oga ogg
@KingYes
KingYes / pojo6891.php
Created October 26, 2014 18:42
Pojo.me - print custom css from our customizer
function pojo6891_print_custom_css_codes( Pojo_Create_CSS_Code $css_code ) {
$css_code->add_value( '.product-title', 'color', get_theme_mod( 'secondary_color' ) );
}
add_filter( 'pojo_wp_head_custom_css_code', 'pojo6891_print_custom_css_codes' );
@KingYes
KingYes / insert-in-your-functions.php
Created January 29, 2015 12:33
Polylang multilang Logo with Pojo theme
function pojo_polylang_get_multilang_sticky_logo( $value ) {
if ( function_exists( 'pll_current_language' ) ) {
$logos = array(
'en' => 'logo-sticky-en.png',
'he' => 'logo-sticky-he.png',
);
$default_logo = $logos['en'];
$current_lang = pll_current_language();
$assets_url = get_stylesheet_directory_uri() . '/assets/images/';
@KingYes
KingYes / insert-in-your-functions.php
Created January 29, 2015 12:35
pojo.me + WPML: Change your sticky logo by language
function pojo_wpml_get_multilang_sticky_logo( $value ) {
if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
$logos = array(
'en' => 'logo-sticky-en.png',
'he' => 'logo-sticky-he.png',
);
$default_logo = $logos['en'];
$current_lang = ICL_LANGUAGE_CODE;
$assets_url = get_stylesheet_directory_uri() . '/assets/images/';
@KingYes
KingYes / patch.php
Created March 25, 2015 06:56
Fixes EDD Software Licenses - Past payments after EDD Upgrade to v2.3
<?php
global $wpdb;
$license_ids = $wpdb->get_col(
"SELECT `post_id` FROM {$wpdb->postmeta}
WHERE `meta_key` LIKE '_edd_sl_user_id'
AND `meta_value` = '0';"
);
if ( ! empty( $license_ids ) ) {
$payment_ids = array();
@KingYes
KingYes / functions.php
Last active August 29, 2015 14:26
Added custom post in Pojo Recent Posts Widget
/**
* @param array $fields
* @param WP_Widget $widget_obj
*
* @return array
*/
function pojo28831_add_custom_post_type_in_recent_posts_widget( $fields, $widget_obj ) {
$fields[] = array(
'id' => '_custom_post_type',
'title' => __( 'Post Type:', 'pojo' ),