Skip to content

Instantly share code, notes, and snippets.

@kraftbj
kraftbj / gist:4394479
Last active December 10, 2015 06:28 — forked from technosailor/gist:4394411
Modal popup form
<?php
/*
Plugin Name: Pop Up Once
Plugin URI: https://gist.github.com/4394411
Description: Quick plugin to create a modal popup form
Author: Aaron Brazell
Author URI: http://technosailor.com
Version: 1.0
*/
@kraftbj
kraftbj / gist:4450225
Created January 4, 2013 05:43
Custom loop in Genesis
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'bk_custom_loop' );
function bk_custom_loop() {
global $paged;
$args = (array(
'paged' => $paged,
'posts_per_page' => 5 // accepts WP_Query args http://codex.wordpress.org/Class_Reference/WP_Query
));
@kraftbj
kraftbj / home.php
Created January 4, 2013 05:50
Custom grid loop in Genesis
<?php
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'bk_grid_loop' );
function bk_grid_loop() {
if ( function_exists( 'genesis_grid_loop' ) ) {
remove_action( 'genesis_before_post_content', 'generate_post_image', 5 );
genesis_grid_loop( array(
'features' => 2,
'feature_image_size' => 'large',
@kraftbj
kraftbj / GPLquestions
Last active December 11, 2015 20:59
GPL questions
1. No, GPL code is not required to be offered publicly.
1a. If you distribute GPL code, you must include the source code (which, in WP world, is basically one and the same). Distribute basically means give/sell to the public. You are not required to give the program to anyone...only give the source code to those you give the program to.
2. Yes. (meant to include the link: http://www.gnu.org/licenses/gpl-faq.html#DoesTheGPLAllowMoney (right to sell is always an option). You cannot, though, say "you can only use this on one site". You can sell the code, but can't limit how it is used. That's why "upgrades" are offered on a subscription or "support and automatic upgrades" offered. Technically, if you have a five-site upgrade subscription, you're allowed, under the GPL, to install it on a sixth. They have the ability to not enable an automatic download, but one you have one copy of GPL software, you can do with it as you will.
3. If you sell/distribute the code (meaning publicly), then the receiver has the righ
@kraftbj
kraftbj / metro.after-post.css
Last active December 11, 2015 22:18
On Metro, if you use the name fields on eNews Extended in the after-post area, the submit button may share a line with the e-mail field, causing it to look weird with the first name field. Use this in place of what's found starting on line 1427 of style.css
.after-post .enews-widget input[type="submit"] {
width: auto;
display: block;
margin: auto;
}
@kraftbj
kraftbj / functions.php
Created February 5, 2013 20:18
Remove "Protected" from post titles
add_filter('protected_title_format', 'no_protected_prefix');
function no_protected_prefix($title) {
return '%s';
}
@kraftbj
kraftbj / functions.php
Created February 5, 2013 20:33
Redirect to home page after logout
add_filter('logout_url', 'logout_go_home', 10, 2);
function logout_go_home($logouturl, $redir)
{
$redir = get_option('siteurl');
return $logouturl . '&amp;redirect_to=' . urlencode($redir);
}
@kraftbj
kraftbj / functions.php
Created February 5, 2013 21:42
Family Tree from Genesis - Make dates look fancy on home page
add_action( 'template_redirect', 'familytree_conditional_actions' );
/**
* Switch out default Genesis post info creation for Family Tree version.
*
* @since 1.0
*/
function familytree_conditional_actions() {
if ( is_page_template( 'page_blog.php' ) || is_post_type_archive() || is_singular( 'post' ) || is_home() ) {
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
@kraftbj
kraftbj / functions.php
Created February 10, 2013 03:37
Change footer creds on Genesis
/** Filter Footer Crds */
add_filter( 'genesis_footer_creds_text', 'kraft_footer_creds_text');
function kraft_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright &copy; ';
echo date(Y);
echo ' [client name] &middot; Development by <a href="http://coffeaweb.com">Coffea Web Services.</a>';
echo '</p></div>';
}
@kraftbj
kraftbj / template.php
Created February 12, 2013 19:09
Conditionally show meta data
<?php
$publication = get_post_meta($post->ID, 'publication', true);
if ($publication) { ?>
<div class="publication">Originally found in <?php echo $publication; ?></div>
<?php }