Skip to content

Instantly share code, notes, and snippets.

View jessengatai's full-sized avatar

Jesse Ngatai jessengatai

View GitHub Profile
@jessengatai
jessengatai / jnt-migration.php
Created June 18, 2017 17:25
A function to help migrate old and outdated theme settings after a theme update
<?php
/**
* This function handles updating old settings that are now outdated and should
* only fire on theme updates and activations.
*
* @since Crush 3.0.7
*/
function jnt_migrate_settings() {
/* re-skin the title sections */
#customize-theme-controls li.accordion-sectional-title {
display: block !important;
background: none;
outline: none;
margin: 30px 15px 10px 15px;
}
#customize-theme-controls li.accordion-sectional-title h3 {
font-size: 18px;
line-height: 1.6;
/* re-skin the title sections */
#customize-theme-controls li.accordion-sectional-title {
display: block !important;
background: none;
outline: none;
padding: 25px 15px 10px 15px;
border: none;
}
#customize-theme-controls li.accordion-sectional-title h3 {
font-size: 18px;
/**
* Enqueue our customizer UI stylesheet so we can style our custom section titles
* @return void
*/
function jn_customizer_ui_styles() {
wp_enqueue_style('jn-customizer-ui-styles', get_theme_file_uri('/jn-customizer-ui-styles.css'), 'all' );
}
add_action( 'customize_controls_enqueue_scripts', 'jn_customizer_ui_styles' );
/**
* Register our sectional titles in the customizer
* @param class $wp_customize Instance of WP_Customize_Manager created when using the 'customize_register' hook
*/
add_action( 'customize_register', 'jn_customizer_titles' );
function jn_customizer_titles( $wp_customize ) {
$text_domain = 'your_themes_text_domain';
// layout
/**
* Add a new section class that allows for adding sectional titles to the customizer
* @param class $wp_customize Instance of WP_Customize_Manager created when using the 'customize_register' hook
*/
add_action( 'customize_register', 'jn_section_titles_class' );
function jn_section_titles_class($wp_customize) {
/**
* Extends the WP_Customize_Section for custom output
* @return void
@jessengatai
jessengatai / install.php
Created November 29, 2016 23:26 — forked from tschoffelen/install.php
A simple PHP script that automatically downloads and unzips the latest version of Wordpress in the current directory (./), so that I don't have to download it and upload it to my server through FTP manually.
<?php
echo '<pre>';
echo '<span style="color:blue">DOWNLOADING...</span>'.PHP_EOL;
// Download file
file_put_contents('wp.zip', file_get_contents('http://wordpress.org/latest.zip'));
$zip = new ZipArchive();
$res = $zip->open('wp.zip');
if ($res === TRUE) {