Skip to content

Instantly share code, notes, and snippets.

View josanua's full-sized avatar
🎯
Focusing

Andrew josanua

🎯
Focusing
View GitHub Profile
@josanua
josanua / gutenberg-helper.php
Last active June 7, 2024 08:18
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";
@josanua
josanua / plugin-text-utils.txt
Last active May 12, 2020 10:08
Plugins text utils
// Contact Form 7 for pipes USA states list select
"Alabama|AL"
"Alaska|AK"
"Arizona|AZ"
"Arkansas|AR"
"California|CA"
"Colorado|CO"
"Connecticut|CT"
"Delaware|DE"
"District of Columbia|DC"
@josanua
josanua / sass.css
Last active May 24, 2023 13:30
sass helper
https://sass-lang.com/guide
https://sass-scss.ru/guide/
/*** Setup watcher in IDE ***/
/usr/local/bin/scss
--no-cache
--update
--sourcemap=none
$FileName$:$ProjectFileDir$/css/$FileNameWithoutExtension$.css
@josanua
josanua / js-helper.js
Last active April 9, 2024 07:33
JS Helper
// Books to read
https://exploringjs.com/impatient-js/
// Defines that JavaScript code should be executed in "strict mode".
'use strict';
// Need to study, in order:
https://www.digitalocean.com/community/tutorials/understanding-variables-scope-hoisting-in-javascript
https://www.digitalocean.com/community/tutorials/understanding-syntax-and-code-structure-in-javascript