Skip to content

Instantly share code, notes, and snippets.

View aliciaduffy's full-sized avatar

Alicia Duffy aliciaduffy

View GitHub Profile
@aliciaduffy
aliciaduffy / gist:1724058
Created February 2, 2012 15:44
reformat pubdate
<xsl:template match="channel">
<xsl:for-each select="item[position()&lt;=1">
<xsl:variable name="date"><xsl:value-of select="pubDate"/></xsl:variable>
<p class="podcastfile">Latest podcast: <a href="{link}">
<xsl:call-template name="FormatDate3"><xsl:with-param name="date" select="substring-before($date, ' +')"/></xsl:call-template>: <strong><xsl:value-of select="title"/></strong></a></p>
</xsl:for-each>
</xsl:template>
<xsl:template name="FormatDate3">
<xsl:param name="date"/>
@aliciaduffy
aliciaduffy / gist:3362628
Last active October 8, 2015 17:08
WordPress / GoogleFonts API
<?php
add_action('wp_print_styles', 'load_fonts');
function load_fonts() {
wp_register_style('googleFonts', 'http://fonts.googleapis.com/css?family=Oswald:700http://<?php echo $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; ?>');
wp_enqueue_style( 'googleFonts');
}
//goes in theme/front-end.php
@aliciaduffy
aliciaduffy / gist:3362635
Last active October 8, 2015 17:08
WordPress / Change Login logo,link,and title
<?php
// changing the login page URL
function THEMENAME_put_my_url(){
return get_home_url(); // changes the url link from wordpress.org to your blog or website's url
}
add_filter('login_headerurl', 'THEMENAME_put_my_url');
// changing the login page URL hover text
function THEMENAME_put_my_title(){
@aliciaduffy
aliciaduffy / gist:3362651
Last active October 8, 2015 17:08
WordPress / Preview Link - add login link
<?php
// Show login link if a user visits a preview link and is logged out
remove_action( 'init', '_show_post_preview' );
add_action( 'init', 'NAME_show_post_preview' );
function NAME_show_post_preview($result='', $id = false) {
// if ?preview=true is set
if ( isset($_GET['preview'])) {
$id = (int) $_GET['preview_id'];
@aliciaduffy
aliciaduffy / gist:3362654
Last active October 8, 2015 17:08
WordPress / ADMIN / Add post type to admin body class
<?php
function POSTTYPE_to_admin_body_class( $classes ) {
global $post; global $post_type;
$mode = '';
$uri = $_SERVER["REQUEST_URI"];
if (strstr($uri,'edit.php')) {
$mode = ' edit-list-';
}
@aliciaduffy
aliciaduffy / gist:3362657
Last active October 8, 2015 17:08
WordPress / ADMIN / Remove Dashboard Boxes
<?php
add_action( 'wp_dashboard_setup', 'NAME_remove_dashboard_widgets', 100);
function NAME_remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
@aliciaduffy
aliciaduffy / gist:3362665
Last active October 8, 2015 17:08
WordPress / ADMIN / Remove items from Admin Bar
<?php
add_action( 'wp_before_admin_bar_render', 'NAME_admin_bar_render' );
function NAME_admin_bar_render() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('comments');
$wp_admin_bar->remove_menu('new-content');
$wp_admin_bar->remove_menu('wpseo-menu');
}
/**
@aliciaduffy
aliciaduffy / gist:3362670
Last active May 12, 2022 03:49
WordPress / ADMIN / Remove meta boxes from post edit screen
<?php
add_action( 'add_meta_boxes', 'NAME_remove_meta_boxes', 100);
function NAME_remove_meta_boxes() {
remove_meta_box( 'trackbacksdiv', 'post', 'normal' ); // Trackbacks meta box
remove_meta_box( 'postcustom', 'post', 'normal' ); // Custom fields meta box
remove_meta_box( 'commentsdiv', 'post', 'normal' ); // Comments meta box
remove_meta_box( 'slugdiv', 'post', 'normal' ); // Slug meta box
remove_meta_box( 'authordiv', 'post', 'normal' ); // Author meta box
remove_meta_box( 'revisionsdiv', 'post', 'normal' ); // Revisions meta box
remove_meta_box( 'formatdiv', 'post', 'normal' ); // Post format meta box
@aliciaduffy
aliciaduffy / WordPress WooCommerce Use generic comments on WoodCommerce Products
Last active October 12, 2015 00:57
Use generic comments on WoodCommerce Products
<?php
add_filter( 'comments_template', 'USEGENERIC_woocommerce_comments', 100);
function USEGENERIC_woocommerce_comments( $template ) {
$template = STYLESHEETPATH . '/comments.php';
return $template;
}
@aliciaduffy
aliciaduffy / Responsive-Email-Gap
Created October 29, 2012 18:11
Fix for Responsive Email gap on the right side in Iphone Mail
<!-- Add min-width: 100%; to body CSS -->
body {
min-width: 100%;
}
<!-- Add 'style="text-align: center;"' and 'align="center"' to wrapper table -->
<table id="wrapper" width="100%" height="100%" style="width: 100%; height: 100%; margin: 0 !important; text-align:center" border="0" cellspacing="0" cellpadding="0" bgcolor="#eaeff2" align="center">
<tbody>
<tr>
<td align="center">