Skip to content

Instantly share code, notes, and snippets.

View freddiemixell's full-sized avatar

Freddie Mixell freddiemixell

View GitHub Profile
@pusherman
pusherman / gist:3145761
Created July 19, 2012 18:13
HTML - Select list of US states
<select name="state" id="state">
<option value="" selected="selected">Select a State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
@muhammad-naderi
muhammad-naderi / functions-mu-encryption.php
Created July 12, 2016 11:57
Wordpress encrypt usermeta data database
<?php
/**
* Created by PhpStorm.
* User: Muhammad
* Date: 05/07/2016
* Time: 01:20 PM
*/
add_filter('get_user_metadata', 'decrypt_user_meta',10,4);
@ahmadawais
ahmadawais / upload-a-file.MD
Created June 18, 2017 11:07 — forked from websupporter/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@zikosw
zikosw / map.js
Created January 10, 2018 14:47
expo map marker
import React from 'react';
import { MapView } from 'expo';
export default class App extends React.Component {
render() {
return (
<MapView
style={{ flex: 1 }}
initialRegion={{
latitude: 37.78825,
@jasonbahl
jasonbahl / like-posts.php
Created December 10, 2018 22:06
Adding a "likePost" mutation for WPGraphQL
add_action( 'graphql_register_types', function() {
register_graphql_field( 'Post', 'likeCount', [
'type' => 'Int',
'description' => __( 'The number of likes for the post', 'your-textdomain' ),
'resolve' => function( $post ) {
$likes = get_post_meta( $post->ID, 'likes', true );
return isset( $likes ) ? (int) $likes : 0;
}
] );
@freddiemixell
freddiemixell / netlify.php
Last active February 15, 2021 11:24
WordPress Netlify Build Hook
<?php
// Somewhere off in your wp-config.php make sure you replace 123456 with your api key.
define( 'NETLIFY_API_KEY', '123456' );
// Somewhere off in your theme or even a plugin.
/**
* Netlify Webhook Build Function
*