Skip to content

Instantly share code, notes, and snippets.

View josanua's full-sized avatar
🎯
Focusing

Andrew josanua

🎯
Focusing
View GitHub Profile
@josanua
josanua / send_smtp_with_wpmail.php
Last active January 30, 2021 03:05 — forked from cabans/send_smtp_with_wpmail.php
Wordpress: Add SMTP settings to wp_mail()
// Action for change default system settings, it work's!
add_action('phpmailer_init','send_smtp_email');
function send_smtp_email( $phpmailer )
{
// Define that we are sending with SMTP
$phpmailer->isSMTP();
// The hostname of the mail server
@josanua
josanua / gist:d1544752467c6f438fc041a630938278
Last active July 27, 2024 06:06 — forked from itsmattsoria/gistfil1.textile
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
@josanua
josanua / wp-robots.txt
Last active August 25, 2019 06:52 — forked from intelliweb/default_wp_robots.txt
robots.txt file for WP
User-agent: *
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins
Disallow: /wp-content/cache
Disallow: /wp-content/themes
Disallow: /wp-includes/js
Disallow: /trackback
Disallow: /category/*/*
Disallow: */trackback
@josanua
josanua / wp-remove-dashboard.php
Last active January 25, 2024 23:53 — forked from chrisguitarguy/wp-remove-dashboard.php
Remove all the default WordPress dashboard widgets.
<?php
/*
Plugin Name: Remove Dashboard Meta Boxes
Plugin URI: http://pmg.co/category/wordpress
Description: Removes the default dashboard widgets from the WordPress admin.
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: GPL2
*/
@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 / 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 / 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 / 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 / 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 / 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';