Skip to content

Instantly share code, notes, and snippets.

View adamdoe's full-sized avatar
🏠
Working from home

Adam Doe adamdoe

🏠
Working from home
View GitHub Profile
@adamdoe
adamdoe / .WordPress
Created April 15, 2016 13:18 — forked from artes-visuales/.WordPress
WordPress
//Theme Structure
header.php ...................... Header Section
index.php ......................... Main Section
sidebar.php .................... Sidebar Section
single.php ....................... Post Template
page.php ......................... Page Template
comments.php .................. Comment Template
search.php ...................... Search Content
searchform.php ............ Search Form Template
archive.php ................... Archive Template
@adamdoe
adamdoe / current_page_share.php
Created June 1, 2016 20:24 — forked from eddt/current_page_share.php
Share Current Page via Facebook
<?php
/**
* Get the current Url taking into account Https and Port
* @link http://css-tricks.com/snippets/php/get-current-page-url/
* @version Refactored by @AlexParraSilva
*/
function getUrl() {
$url = isset( $_SERVER['HTTPS'] ) && 'on' === $_SERVER['HTTPS'] ? 'https' : 'http';
$url .= '://' . $_SERVER['SERVER_NAME'];
$url .= in_array( $_SERVER['SERVER_PORT'], array('80', '443') ) ? '' : ':' . $_SERVER['SERVER_PORT'];
@adamdoe
adamdoe / .gitignore
Last active April 30, 2020 05:24 — forked from eddt/wordpress gitignore
WordPress - .gitignore #wordpress
*.log
.htaccess
sitemap.xml
sitemap.xml.gz
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
function add_alt_tags($content)
{
global $post;
preg_match_all('/<img (.*?)\/>/', $content, $images);
if(!is_null($images))
{
foreach($images[1] as $index => $value)
{
if(!preg_match('/alt=/', $value))
{
@adamdoe
adamdoe / Last Updated Stamp
Last active April 30, 2020 05:29
WordPress - Check modified time after published time #wordpress
function add_last_updated()
{
$post_time = strtotime(get_post_time('m.d.Y'));
$mod_time = strtotime(get_post_modified_time('m.d.Y'));
$mod_date = get_the_modified_time('m.d.Y');
$date = get_the_date('m.d.Y');
$display_date = ($post_time < $mod_time ? $mod_date : $date);
if ($post_time != $mod_time)
{
{
"folders": [
{
"folder_exclude_patterns": [
"wp-includes",
"wp-admin",
"wp-content/uploads",
".idea"
],
"path": "PATH HERE",
@adamdoe
adamdoe / functions.php
Last active August 23, 2017 13:53
Get user of role type and add them into columns using Foundation.
/**
* Author : Doe
* @param string $role_type used for getting type of user.
*/
function get_team_members($role_type) {
$args = array(
'role' => $role_type,
'fields' => 'ID'
);
@adamdoe
adamdoe / functions.php
Last active March 13, 2021 20:27
WordPress - Admin Functions #wordpress
<?php
/******************************************************************
* Admin Footer
******************************************************************/
function change_admin_footer(){
echo '<span id="footer-note">Theme made by <a href="http://www.yourcompany.com/" target="_blank">Your Company</a>.</span>';
}
add_filter('admin_footer_text', 'change_admin_footer');
@adamdoe
adamdoe / sql
Last active April 30, 2020 05:11
WordPress - SQL Statements for Migration #wordpress
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@adamdoe
adamdoe / Animal.js
Last active June 1, 2021 22:05
Animal.js #js
/**
* ES6 Classes
* Notes:
* - instead of adding methods to the prototype
* can add them directly to class.
*/
class Animal {
constructor(name, age) {
this._name = name;
this._age = age;