Skip to content

Instantly share code, notes, and snippets.

@ramseyp
ramseyp / naked-css-wp.php
Last active April 9, 2020 15:31
WP snippets for CSS Naked Day
<?php
function bk_is_naked_day($d) {
$start = date('U', mktime(-12, 0, 0, 04, $d, date('Y')));
$end = date('U', mktime(36, 0, 0, 04, $d, date('Y')));
$z = date('Z') * -1;
$now = time() + $z;
if ( $now >= $start && $now <= $end ) {
return true;
}
@ramseyp
ramseyp / filter-shared-data.php
Created February 12, 2019 22:09
filter shared counts data
function shared_counts_flipboard_data_properties( $attr, $link ) {
if ( 'flipboard' === $link['type'] ) {
$attr['flip-widget'] = 'shareflip';
}
return $attr;
}
add_filter( 'shared_counts_link_data', 'shared_counts_flipboard_data_properties', 5, 2 );
<?php
remove_action('genesis_loop', 'genesis_do_loop');
add_action('genesis_loop', 'custom_loop');
function custom_loop() {
echo '<h1 class="entry-title" itemprop="headline">'.get_the_title().'</h1>';
echo '<div class="clear"></div>';
echo '<div class="singlebio">';
@ramseyp
ramseyp / tmpl_child-pages.php
Created August 20, 2014 03:10
Genesis child theme custom page template that shows child pages of the current page. Heavily based on: https://gist.github.com/billerickson/3218052
<?php
/*
Template Name: Custom Loop
*/
remove_action( 'genesis_loop','genesis_do_loop' );
add_action( 'genesis_loop','my_custom_loop' );
function my_custom_loop() {
@ramseyp
ramseyp / rsync command with multiple exclusions
Created May 12, 2014 22:11
rsync while excluding multiple directories
rsync -arv --exclude="*.git" --exclude=".svn" source/ /destination/
@media only screen and (max-width: 1139px) {
.site-header .widget-area {
width: 600px;
}
.genesis-nav-menu a {
padding: 40px 7px 20px;
}
# # BEGIN WordPres<I<IfModule mod_rewrite.cReRewriteEngine OReRewriteBase ReRewriteRule ^index\.php$ - [LReRewriteCond %{REQUEST_FILENAME} !-ReRewriteCond %{REQUEST_FILENAME} !-RewriteRule . /index.php [L]
</IfModule>
# END WordPress
s
@ramseyp
ramseyp / custom_comments.php
Last active November 20, 2024 12:14
Different ways of customizing the WordPress comment form
<?php
// Customized the comment form fields ( not the comment text area )
add_filter('comment_form_default_fields', 'my_comment_form_args');
// Customizes the text area - you have to do this here, rather than in comment_form_default_fields
add_filter('comment_form_field_comment', 'my_comment_form_field_comment');
// Customized the comment notes above the form fields
add_filter( 'comment_form_defaults', 'my_comment_form_defaults' );
@ramseyp
ramseyp / if_exists.php
Last active August 29, 2015 13:56
Check to see if something exists before you call some function / class / method in your WordPress functions.php
<?php
if ( function_exists( 'function_name' ) ) {
//... do something ...
}
if ( class_exists( 'Class_Name' ) ) {
@ramseyp
ramseyp / custom-jetpack-share.php
Last active August 29, 2015 13:56
Empty the Jetpack Sharing Label input; localize a script to feed it a custom value, wrapped in a p tag.
<?php
/**
* If the Jetpack Sharing label setting has a value, remove it.
* If that field is empty, Jetpack Sharing will not output a set of H3 tags with the label.
*
*/
function sharing_label_clear() {
if ( class_exists( 'Sharing_Service' ) ) :