Skip to content

Instantly share code, notes, and snippets.

View josanua's full-sized avatar
🎯
Focusing

Andrew josanua

🎯
Focusing
View GitHub Profile
@josanua
josanua / alpha_control.php
Created September 3, 2024 16:34 — forked from stevenmunro/alpha_control.php
How to add a color control with alpha/opacity to the WordPress theme customizer
<?php
// See full blog post here
// http://pluto.kiwi.nz/2014/07/how-to-add-a-color-control-with-alphaopacity-to-the-wordpress-theme-customizer/
function pluto_add_customizer_custom_controls( $wp_customize ) {
class Pluto_Customize_Alpha_Color_Control extends WP_Customize_Control {
public $type = 'alphacolor';
@josanua
josanua / site-title-smilies.php
Created August 30, 2024 08:43 — forked from westonruter/site-title-smilies.php
Selective refresh example plugin
<?php
/**
* Plugin name: Site Title (and Tagline) Smilies
* Description: Demonstration of selective refresh in the Customizer. Selectors are targeting elements in Twenty Fifteen.
* Author: Weston Ruter, XWP
* Plugin URL: https://gist.github.com/westonruter/a15b99bdd07e6f4aae7a
*
* @package SiteTitleSmilies
*/
@josanua
josanua / pe-customize-controls.css
Created August 14, 2024 13:15 — forked from OriginalEXE/pe-customize-controls.css
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@josanua
josanua / gutenberg-helper.php
Last active October 14, 2024 06:14
gutenberg helper
<?
/**
* Getting Started
* "Gutenberg" is a codename for a whole new paradigm in WordPress site building and publishing
* Official repository https://github.com/WordPress/gutenberg
*/
// Getting Started with editor UI
https://wordpress.org/support/article/wordpress-editor/
@josanua
josanua / bs4pagination.php
Last active January 25, 2022 14:24
bs4pagination
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
*
* @return string
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
* - Tested on WP 4.9.5
* - Tested with Bootstrap 4.1
@josanua
josanua / bs4Navwalker.php
Last active October 30, 2020 08:07
bs4 Navwalker standard for wp
<?php
/**
* Class Name: bs4Navwalker
* GitHub URI: https://github.com/dupkey/bs4navwalker
* Description: A custom WordPress nav walker class for Bootstrap 4 nav menus in a custom theme using the WordPress built in menu manager.
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
@josanua
josanua / bs4breadcrumbs.php
Created October 30, 2020 07:59
bs4breadcrumbs for wp
<?php
/**
* Retrieve category parents.
*
* @param int $id Category ID.
* @param array $visited Optional. Already linked to categories to prevent duplicates.
* @return string|WP_Error A list of category parents on success, WP_Error on failure.
*
* file name: bs4breadcrumbs.php
@josanua
josanua / wp-bootstrap4.4-pagination.php
Created October 29, 2020 15:53 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
@josanua
josanua / is_dir.php
Created September 22, 2020 12:25 — forked from Dare-NZ/is_dir.php
Connect via FTP and check if directory exists
<?php
// FTP login details
$ftp_server = 'yourserver.com';
$ftp_server_path = '/public_html/';
$ftp_user_name = 'username';
$ftp_user_pass = 'password';
// Connect to the FTP
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
@josanua
josanua / php-ftp-file-upload-function.php
Created September 14, 2020 14:35 — forked from steveosoule/php-ftp-file-upload-function.php
PHP FTP File Upload Function
<?
$ftp_server = "ftp.domainname.com";
$ftp_user_name = "ftp_username";
$ftp_user_pass = "ftp_password";
$ftp_directory = 'path/to/folder/'; // leave blank
$ftp_source_file_name = "data.xml";
$ftp_dest_file_name = $ftp_source_file_name;
if( ftp_file( $ftp_server, $ftp_user_name, $ftp_user_pass, $ftp_source_file_name, $ftp_directory, $ftp_dest_file_name) ){
echo "Success: FTP'd data\n";