Skip to content

Instantly share code, notes, and snippets.

View csymlstd's full-sized avatar

Casey Milstead csymlstd

View GitHub Profile
@csymlstd
csymlstd / add_yoast_meta.php
Created February 19, 2018 18:04
Add Yoast Meta
<?php
function add_to_yoast_seo($post_id, $metatitle, $metadesc, $metakeywords){
$ret = false;
// Include plugin library to check if Yoast Seo is presently active
include_once( ABSPATH.'panel/includes/plugin.php' );
if(is_plugin_active(ABSPATH.'wp-content/plugins/wordpress-seo/wp-seo.php')) {
//plugin is activated
$updated_title = update_post_meta($post_id, '_yoast_wpseo_title', $metatitle);
@csymlstd
csymlstd / acf-states.txt
Created March 22, 2018 18:56
ACF States for Select
AL : Alabama
AK : Alaska
AZ : Arizona
AR : Arkansas
CA : California
CO : Colorado
CT : Connecticut
DE : Delaware
DC : District of Colombia
FL : Florida
@csymlstd
csymlstd / auth0-wordpress-config.md
Last active March 28, 2018 18:42
auth0 wordpress
@csymlstd
csymlstd / wp-get-post-by-meta.php
Created March 28, 2018 21:10
get wordpress post id by post_meta key and value
<?php
if (!function_exists('get_post_id_by_meta_key_and_value')) {
/**
* Get post id from meta key and value
* @param string $key
* @param mixed $value
* @return int|bool
* @author David M&aring;rtensson <david.martensson@gmail.com>
*/
function get_post_id_by_meta($key, $value) {
@csymlstd
csymlstd / location-finder-en-espanol.txt
Created May 1, 2018 20:54
Spanish translations for location finder
"Getting your current location" = Obteniendo tu ubicación actual
"Allow your browser to use geolocation when requested, or search above." = Permite que tu navegador habilite la geolocalización, o utiliza la función de búsqueda situada en la parte superior.
"Could not get your current location" = No pudimos obtener tu ubicación actual
"We couldn't find any locations near you" = No encontramos ubicaciones cercanas a ti
"Enable Geolocation in your browser or mobile device settings and try again, or search above" = Habilita la geolocalización en tu navegador o en la configuración de tu dispositivo móvil e intenta de nuevo, o utiliza la función de búsqueda situada en la parte superior.
@csymlstd
csymlstd / wp-get-current-queried-object.php
Created May 18, 2018 20:20
wp index.php - get current page id instead of first post
<?php
$post = get_queried_object();
$index_id = $post->ID;
?>
@csymlstd
csymlstd / fix-wordpress-permissions.sh
Created May 22, 2018 19:42 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@csymlstd
csymlstd / commands.sh
Created June 26, 2018 20:51
git commands
# go back to a commit and remove commits ahead
git reset --hard 203b24f
git push origin HEAD --force
@csymlstd
csymlstd / gist:b340921e517e92c65a0b8113d2f174fc
Created November 22, 2016 18:00
Foundation 6 data-toggler iPhone Fix
$('[data-toggle]').on('click', function() {
$(document).trigger('click.zf.trigger', '[data-toggle]');
});
@csymlstd
csymlstd / reset.sh
Created July 6, 2018 20:48
Reset MySQL Password on Ubuntu 16.04
# Stop MySQL Service
sudo systmctl stop mysql
# Make service directory and give permission to mysql to write
sudo mkdir /var/run/mysqld
sudo chown mysqld: /var/run/mysqld
# Start MySQL manually
sudo mysqld_safe --skip-grant-tables --skip-networking &