Skip to content

Instantly share code, notes, and snippets.

@wolfthemes
wolfthemes / php.ini
Created February 10, 2017 11:53
Minimal PHP configuration for WordPress
memory_limit = 96M
max_input_vars = 3000
max_execution_time = 120
post_max_size = 32M
upload_max_filesize = 32M
@wolfthemes
wolfthemes / zipit.php
Last active February 14, 2017 12:39
Zip a folder and all subfolders in it
<?php
/**
* Zip a folder
*
* @param string $src path to folder path/folder
* @param string $dest destination name path/folder.zip
* @see http://stackoverflow.com/questions/4914750/how-to-zip-a-whole-folder-using-php
*/
function zipit( $src, $dest = null ) {
@wolfthemes
wolfthemes / overwrite-post-type-slug.php
Last active February 5, 2018 14:53
To overwrite your post type slug, use the following function and refresh your permalink structure.
<?php
/**
* Overwrite custom post type slug
*
* @param array $args
* @param string $post_type
* @return array $args
*
* @link https://wordpress.stackexchange.com/questions/247706/how-to-change-custom-post-type-slug
*/
<?php
/**
* Allow SVG files
*
* @param array $mimes
* @return array $mimes
*/
function wolf_mime_types( $mimes ) {
$mimes['svg'] = 'image/svg+xml';
$mimes['svgz'] = 'image/svg+xml';
background: linear-gradient(330deg, #e05252 0%, #99e052 25%, #52e0e0 50%, #9952e0 75%, #e05252 100%);
background-clip: text;
text-fill-color: transparent;
@wolfthemes
wolfthemes / grid.scss
Last active July 24, 2018 12:39
Ultra simple grid
// Column bottom margin and width on mobile when columns are stacked
.col{
width:100%;
margin-bottom:2em;
}
$gap : 35px; // space between columnd
$gutter : $gap / 2;
// Grid system for screen larger than 800px
@wolfthemes
wolfthemes / rtl.php
Last active December 11, 2018 17:01
/**
* Enqueue RTL CSS stylesheet
*/
function enqueue_rtl_styles() {
// Dequeue main CSS file
wp_dequeue_style( 'theme-style' ); // replace "theme" by your the theme slug
wp_deregister_style( 'theme-style' ); // replace "theme" by your the theme slug
// Enqueue auto-generated rtl CSS file
wp_enqueue_style( 'rtl', get_template_directory_uri() . '/rtl.css' );
/**
* Adjust the sticky menu scrollpoint
*
* @param int $int
* @return int
*/
function tune_overwrite_sticky_menu_scrollpoint( $int ) {
return 200; // replace by your scrollpoint value in pixels
}
/**
* Overwrite single release buttons
*/
function overwrite_release_buttons( $html ) {
$meta = ( function_exists( 'wd_get_meta' ) ) ? wd_get_meta() : array();
$release_itunes = $meta['itunes'];
$release_google_play = $meta['google_play'];
$release_amazon = $meta['amazon'];
$release_buy = $meta['buy'];