Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Change Admin URL
*
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
<?php
/*
Plugin Name: Universal Media Library
Description: Make the pretty post/page media library accessibe from anywhere
Author: Jörn Lund
Author URI: http://github.org/mcguffin
Version: 0.0.1
*/
@mcguffin
mcguffin / grey-out-disabled.php
Last active August 29, 2015 14:12
WordPress Plugin greying out disabled buttons
<?php
/*
Plugin Name: Grey out Disabled
Plugin URI: https://gist.github.com/mcguffin/7cbfb0dab73eb32cb4a2
Description: Grey out disabled submit buttons
Author: Jörn Lund
Author URI: http://github.org/mcguffin
Version: 0.0.1
*/
<?php
/*
Plugin Name: WP reCaptcha comment form fix
Plugin URI: https://gist.github.com/mcguffin/97d7f442ee3e92b7412e
Description: Will bring back reCaptcha to comment form
Author: Jörn Lund
Author URI: http://github.org/mcguffin
Version: 0.0.1
*/
@mcguffin
mcguffin / acf-get-field-key.php
Last active June 13, 2023 13:32
WordPress Advanced Custom Fields get field key from field name
<?php
/**
* Get field key for field name.
* Will return first matched acf field key for a give field name.
*
* ACF somehow requires a field key, where a sane developer would prefer a human readable field name.
* http://www.advancedcustomfields.com/resources/update_field/#field_key-vs%20field_name
*
* This function will return the field_key of a certain field.
@mcguffin
mcguffin / comment-form.php
Created March 23, 2015 19:35
WP-Recaptcha-Integration: A working custom comment form.
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if (is_user_logged_in()) : ?>
<p>
<?php printf(__('Logged in as <a href="%s/wp-admin/profile.php">%s</a>.', 'shoestrap'), get_option('siteurl'), $user_identity); ?>
<a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php __('Log out of this account', 'shoestrap'); ?>"><?php _e('Log out &raquo;', 'shoestrap'); ?></a>
</p>
<?php else : ?>
<div class="form-group">
<label for="author"><?php _e('Name', 'shoestrap'); if ($req) _e(' (required)', 'shoestrap'); ?></label>
<input type="text" class="form-control" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" <?php if ($req) echo 'aria-required="true"'; ?>>
@mcguffin
mcguffin / generate-ratio-grid.php
Last active August 29, 2015 14:17
Generate SASS code for fixed aspect ratio layout grid.
<?php
/* Copyright 2015 Jörn Lund https://github.com/mcguffin/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@mcguffin
mcguffin / polylang-fix-acf-relational.php
Created October 26, 2015 17:13
Polylang: Fix missing value on ACF relational fields
<?php
/*
Plugin Name: Polylang: Fix missing value on ACF relational fields
Plugin Description: ACF relational Field value for translated posts types where not displayed when Admin langauge differs from post language.
Author: Jörn Lund
Author URI: http://github.org/mcguffin
Version: 0.0.1
*/
@mcguffin
mcguffin / .htaccess
Last active September 16, 2021 20:47
Generic Cachify .htaccess for ssl enabled sites
# BEGIN CACHIFY
<IfModule mod_rewrite.c>
# ENGINE ON
RewriteEngine on
RewriteBase /
# set hostname directory
RewriteCond %{HTTPS} on
RewriteRule .* - [E=CACHIFY_HOST:https-%{HTTP_HOST}]
@mcguffin
mcguffin / git-release
Last active December 26, 2022 11:09
Shell script to create GitHub release
#!/bin/bash
MESSAGE="0"
VERSION="0"
DRAFT="false"
PRE="false"
BRANCH="master"
GITHUB_ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
# get repon name and owner