Skip to content

Instantly share code, notes, and snippets.

View eddt's full-sized avatar

Edd Twilbeck eddt

  • Ocean Springs, MS
View GitHub Profile
/* Small Devices, Tablets */
@media only screen and (max-width : 768px) {
.animated {
/*CSS transitions*/
-o-transition-property: none !important;
-moz-transition-property: none !important;
-ms-transition-property: none !important;
-webkit-transition-property: none !important;
transition-property: none !important;
/*CSS transforms*/
@eddt
eddt / npm-commands.md
Created January 31, 2019 15:17 — forked from ankurk91/npm-commands.md
Useful npm commands and tricks

npm v3.10 - ◾

⚠️ This gist is outdated, but most of the commands are still relevant.

Update npm itself

npm install -g npm
# Downgrade to a specific version
npm install -g npm@2
@eddt
eddt / functions.php
Created October 14, 2016 19:16 — forked from bamadesigner/functions.php
WordPress Multsite - wp_get_post_featured_image_src() - Get wp_get_attachment_image_src() data for any post's featured image on your network
/**
* This function allows you to retrieve the wp_get_attachment_image_src()
* data for any post's featured image on your network. If you are running
* a multisite network, you can supply another blog's ID to retrieve a post's
* featured image data from another site on your WordPress multisite network.
*
* Does not take care of icon business (at this time).
*
* If successful, this function returns an array of the following:
* [0] => url
@eddt
eddt / gschentry-fix-functions.php
Created July 7, 2016 13:48
Google Search Console Hentry error fix
<? php
//Fix for missing author, entry title, and updated in GSC
////add hentry data
function add_hentry_data($content) {
$t = get_the_modified_time('F jS, Y');
$author = get_the_author();
$title = get_the_title();
if (is_home() || is_singular() || is_archive() ) {
$content .= '<div class="hentry-extra" style="display:none;visibility:hidden;"><span class="entry-title">'.$title.'</span> was last modified: <span class="updated"> '.$t.'</span> by <span class="author vcard"><span class="fn">'.$author.'</span></span></div>';
}
@eddt
eddt / account-create.php
Last active June 22, 2016 20:25
Create WP Account from External Form Submit
<?php
// define some vars
require_once '../wp-config.php';
if ( defined( 'ABSPATH' ) )
$abspath = ABSPATH;
else
$abspath = '/home/mic/public_html/dev/wptest';
/*
* define the role of the new user here
@eddt
eddt / current_page_share.php
Created June 1, 2016 20:22 — forked from jawinn/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'];
@eddt
eddt / POST Body tag insert
Created May 10, 2016 15:07
inserts content after opening body tag
add_filter('template_include','yoursite_template_include',1);
function yoursite_template_include($template) {
ob_start();
return $template;
}
add_filter('shutdown','yoursite_shutdown',0);
function yoursite_shutdown() {
$insert = "\n<!--YOUR INSERTED ". get_option('setting_a') ." HTML GOES HERE-->";
$content = ob_get_clean();
$content = preg_replace('#<body([^>]*)>#i',"<body$1>{$insert}",$content);
*.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/
@eddt
eddt / wp-get_id_by_slug
Last active December 19, 2017 08:22 — forked from davidpaulsson/wp-get_id_by_slug
WordPress: Get page ID from slug
// Usage:
// get_id_by_slug('any-page-slug','any-post-type');
function get_id_by_slug($page_slug, $slug_page_type = 'page') {
$find_page = get_page_by_path($page_slug, OBJECT, $slug_page_type);
if ($find_page) {
return $find_page->ID;
} else {
return null;
}
@eddt
eddt / Create a custom pagination
Created December 2, 2015 18:01 — forked from corsonr/Create a custom pagination
A simple pagination in a few lines of code
<?php
/* ------------------------------------------------------------------*/
/* PAGINATION */
/* ------------------------------------------------------------------*/
//paste this where the pagination must appear
global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!