Skip to content

Instantly share code, notes, and snippets.

View rku4er's full-sized avatar
🌍
Working from home

Roman K rku4er

🌍
Working from home
  • Ukraine
View GitHub Profile
@cfxd
cfxd / shortcode.css
Last active November 17, 2021 05:53
How to Make the WordPress Video Shortcode Responsive. See http://cfxdesign.com/how-to-make-the-wordpress-video-shortcode-responsive
.wp-video, video.wp-video-shortcode, .mejs-container, .mejs-overlay.load {
width: 100% !important;
height: 100% !important;
}
.mejs-container {
padding-top: 56.25%;
}
.wp-video, video.wp-video-shortcode {
max-width: 100% !important;
}
@w0rm
w0rm / svgstore.html
Created August 6, 2014 15:26
Load combined svg file into body
<html>
<body>
<!-- load combined svg file (with symbols) into body-->
<script>
(function (doc) {
var scripts = doc.getElementsByTagName('script')
var script = scripts[scripts.length - 1]
var xhr = new XMLHttpRequest()
xhr.onload = function () {
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
@foxydot
foxydot / gist:9075575
Created February 18, 2014 17:29
wp_editor wpalchemy repeating
<?php
$mb->the_field('content');
$mb_content = html_entity_decode($mb->get_the_value(), ENT_QUOTES, 'UTF-8');
$mb_editor_id = sanitize_key($mb->get_the_name());
$mb_settings = array('textarea_name'=>$mb->get_the_name(),'textarea_rows' => '5',);
wp_editor( $mb_content, $mb_editor_id, $mb_settings );
?>
@thelebster
thelebster / gist:8797865
Created February 4, 2014 03:48
Using gzip and gunzip with mysql to import/export backups
Exporting:
mysqldump -u user -p database | gzip > database.sql.gz
Importing:
gunzip < database.sql.gz | mysql -u user -p database
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@rakeshtembhurne
rakeshtembhurne / import_export_gz.sql
Created July 15, 2013 08:40
MySQL: Import and export in gzip form
// Export database in gzip form
mysqldump -u user -p database | gzip > database.sql.gz
// Import database from gzip form
gunzip < database.sql.gz | mysql -u user -p database
/**
* $.parseParams - parse query string paramaters into an object.
*/
(function($) {
var re = /([^&=]+)=?([^&]*)/g;
var decode = function(str) {
return decodeURIComponent(str.replace(/\+/g, ' '));
};
$.parseParams = function(query) {
var params = {}, e;
@benvisser
benvisser / Wordpress Rewrite Rules Example
Created October 11, 2012 02:13
Sample Wordpress rewrite rule filters
///////////////////////////////////
// Rewrite Rules
///////////////////////////////////
//rewrite rules
add_filter('rewrite_rules_array','wp_insertMyRewriteRules');
add_filter('query_vars','wp_insertMyRewriteQueryVars');
add_filter('init','flushRules');
// Remember to flush_rules() when adding rules
@raideus
raideus / acf-wrapper-functions.php
Created September 3, 2012 19:29
Wrapper functions for Advanced Custom Fields
<?php
/**
* Return a custom field stored by the Advanced Custom Fields plugin
*
* @global $post
* @param str $key The key to look for
* @param mixed $id The post ID (int|str, defaults to $post->ID)
* @param mixed $default Value to return if get_field() returns nothing
* @return mixed
* @uses get_field()