Skip to content

Instantly share code, notes, and snippets.

@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 / 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.
<?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 / 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: 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
*/
<?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.