Skip to content

Instantly share code, notes, and snippets.

View josanua's full-sized avatar
🎯
Focusing

Andrew josanua

🎯
Focusing
View GitHub Profile
@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 / 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 / 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 / gist:d1544752467c6f438fc041a630938278
Last active February 16, 2024 08:32 — 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 / 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