Skip to content

Instantly share code, notes, and snippets.

View dcangulo's full-sized avatar
💻

David Angulo dcangulo

💻
View GitHub Profile
@dcangulo
dcangulo / index-oop.php
Last active April 3, 2018 06:20
A WordPress plugin shortcode template on both oop and procedural approach. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: Example Shortcode Plugin
Plugin URI: https://wordpress.org/plugins/
Description: Just another example shortcode plugin.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
*/
@dcangulo
dcangulo / seo-friendly-url.php
Last active April 14, 2019 07:08
A PHP function that converts string to an SEO friendly string. Visit https://www.davidangulo.xyz/ for more information.
<?php
function seoFriendlyUrl($string) {
$string = strtolower($string);
$string = preg_replace('/[^a-z0-9_\s-]/', '', $string);
$string = preg_replace('/[\s_]/', '-', $string);
return $string;
}
//Visit the tutorial for more information
//https://www.davidangulo.xyz/how-to-create-seo-friendly-url-in-php/
@dcangulo
dcangulo / upload.php
Last active April 3, 2018 06:17
A simple WordPress plugin that allows you to upload files programatically. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: Upload Files Programatically
Plugin URI: https://wordpress.org/plugins/
Description: Just another file uploader plugin.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
*/
@dcangulo
dcangulo / admin.php
Last active April 3, 2018 06:16
A WordPress plugin template that has an admin menu. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: My WordPress Plugin
Plugin URI: https://wordpress.org/plugins/
Description: Just another WordPress plugin.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
*/
@dcangulo
dcangulo / function.php
Last active April 3, 2018 06:15
A PHP function that abbreviates numbers. (Eg. 1000 to 1K+). Visit https://www.davidangulo.xyz/ for more information.
<?php
function abbreviateNumber($num) {
if ($num >= 0 && $num < 1000) {
$format = floor($num);
$suffix = '';
}
else if ($num >= 1000 && $num < 1000000) {
$format = floor($num / 1000);
$suffix = 'K+';
}
@dcangulo
dcangulo / submenu.php
Last active April 3, 2018 06:14
A WordPress plugin template with menu and submenu. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: My WordPress Plugin
Plugin URI: https://wordpress.org/plugins/
Description: Just another WordPress plugin.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
*/
@dcangulo
dcangulo / class.verifyEmail.php
Last active March 19, 2024 10:17
A PHP class file that can be used to check if an email address is valid using SMTP protocol. Visit https://www.davidangulo.xyz/ for more information.
<?php
/**
* Class to check up e-mail
*
* @author Konstantin Granin <kostya@granin.me>
* @copyright Copyright (c) 2015, Konstantin Granin
*/
class verifyEmail {
@dcangulo
dcangulo / cron.php
Created April 3, 2018 07:51
A simple WordPress plugin that has a cron schedule. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: My cron WordPress plugin
Plugin URI: wordpress.org/plugins
Description: A simple WordPress plugin that executes many times in a certain interval.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
License: GPL2
*/
@dcangulo
dcangulo / settings.php
Created April 3, 2018 14:05
A WordPress plugin settings page template. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: Wordpress plugin with settings
Plugin URI: wordpress.org/plugins
Description: Just another WordPress plugin with settings page.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
License: GPL2
*/
@dcangulo
dcangulo / dashboard-widget.php
Created April 4, 2018 04:38
A dashboard widget code in WordPress. Visit https://www.davidangulo.xyz/ for more information.
<?php
/*
Plugin Name: Dashboard Widget Example
Plugin URI: https://www.davidangulo.xyz/portfolio/
Description: Just another WordPress plugin with dashboard widget.
Version: 1.0.0
Author: David Angulo
Author URI: https://www.davidangulo.xyz/
License: GPL2
*/