Skip to content

Instantly share code, notes, and snippets.

View MikeNGarrett's full-sized avatar
🤘
Rocking this project.

Mike Garrett MikeNGarrett

🤘
Rocking this project.
View GitHub Profile
@louisremi
louisremi / LICENSE.txt
Created October 30, 2011 22:45 — forked from 140bytes/LICENSE.txt
popstate, polyfill that executes window.onpopstate callback whenever location.hash changes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 @louis_remi <http://louisremi.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@level09
level09 / rebuild_permissions
Created July 21, 2012 12:02
Drush: rebuild permissions table using command line in Drupal
drush php-eval 'node_access_rebuild();'
@claudiosanches
claudiosanches / node.tpl.php
Created October 4, 2012 18:28
Drupal - Get node permalink
<?php print get_node_permalink($node); ?>
<?php
/**
* This file will demonstrate a method to export fields to code.
* You can use this to easily create fields using the UI, export to code
* and then use in a custom module. Upon installation of the module
* your fields and instances will already be set up.
*/
// Create the fields you want using the Drupal UI.
// On the same site, go to example.com/devel/php
@stevegrunwell
stevegrunwell / gist:11c3e9d370127fa97898
Last active May 13, 2021 22:44
Bulk-upgrade WordPress plugins using WP-CLI, committing each upgrade to Git as we go
#! /bin/bash
# Find available updates for WordPress plugins via WP-CLI, then upgrade theme one at a time.
# After each upgrade, commit the changed files to Git.
#
# Requires that WP-CLI be installed and in your path: http://wp-cli.org/
#
# Currently, it will only work when run from the root of the WordPress installation, and has
# a hard-coded path for wp-content/plugins.
#
@jawinn
jawinn / primary_category.php
Last active December 8, 2022 21:42
Display Primary Category (Yoast's WordPress SEO)
<?php
/**
* Get the Yoast primary category from its post meta value, and displays it, with HTML markup.
* If there is no primary category set, it displays the first assigned category.
*
* @param boolean $useCatLink Whether to link the category, if it exists
* @return void
*/
function yourtheme_display_yoast_primary_category( $useCatLink = true ) {
@vishalkakadiya
vishalkakadiya / mysql(wp)-commands.txt
Last active October 31, 2022 16:48
WordPress(or any mysql database) - Convert special characters(eg. Latin-1) to UTF-8 in mysql database
The actual step-by-step WordPress / MySQL fix…
1. Back up all your stuff first (likely using phpMyAdmin / CPANEL)
Before doing any of the following it strongly encouraged to back up all your data and files. Just to be safe. At the very least, your full database and the WordPress config file: wp-config.php
2. Note the settings that your WordPress is currently using (from wp-config.php)
Specifically, your MySQL database configuration, including DB_NAME, DB_USER, DB_PASSWORD, and also DB_CHARSET and DB_COLLATE
// ** MySQL settings - You can get this info from your web host ** //