Skip to content

Instantly share code, notes, and snippets.

@ashleyfae
ashleyfae / track-login-ips.php
Created September 4, 2015 13:57
Emails the site administrator whenever a user logs in.
/**
* Track User IP
*
* Emails the site administrator with the logged in user's IP
* address. Triggers whenever a person logs in.
*
* @param string $user_login Username of logged in user
* @param WP_User $user User object
*
* @return void
<?php
/*
* Plugin Name: Comment Link After Post
* Plugin URI: https://www.nosegraze.com/questions/comment-link-below-post/
* Description: Adds a link to the comment area below the post.
* Version: 1.0
* Author: Nose Graze
* Author URI: http://www.nosegraze.com
* License: GPL2
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@ashleyfae
ashleyfae / index.php
Last active December 28, 2015 17:56
Display UBB stars inside the Loop in your theme
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/*
* You must start this code inside The Loop.
*/
$rating = new UBB_Rating();
<?php get_header(); ?>
<h1>This is my first theme</h1>
<p>Chupa chups fruitcake gummi bears. Chocolate cake brownie gummi bears lollipop lemon drops jelly-o. Chocolate liquorice topping. Bonbon sesame snaps candy canes wafer chocolate bar applicake dessert tart. Tart jelly-o halvah jelly beans marzipan marzipan. Jelly beans gingerbread chocolate bar tootsie roll gummies liquorice gummi bears gummies sweet. Wafer oat cake fruitcake topping muffin. Sesame snaps danish pie bear claw.</p>
<p>Marzipan marzipan unerdwear.com dragée. Cheesecake biscuit tiramisu sesame snaps. Toffee fruitcake tootsie roll unerdwear.com sweet roll fruitcake pastry topping icing. Apple pie cake lemon drops apple pie tootsie roll applicake chocolate cheesecake caramels. Sweet roll sesame snaps muffin. Tart marshmallow chupa chups wafer. Chupa chups gingerbread tiramisu brownie macaroon lemon drops. Halvah bonbon sweet gingerbread sweet roll wafer apple pie cupcake sweet roll. Bear claw icing dragée lemon drops chocolate.</p>
<p>Cookie
/**
* Exclude a specific category from your RSS feed.
*
* @param WP_Query $query
*
* @return WP_Query
*/
function exclude_category_from_rss( $query ) {
$cat_id = 0; // Change this to be the ID of the category you want to exclude, but put a - in front. Example: -99
if ( $query->is_feed ) {
<?php
/**
* Plugin Name: Naked Social Share Add-On
* Plugin URI: https://www.nosegraze.com
* Description: Demonstrates how to add an extra social site to Naked Social Share.
* Version: 1.2
* Author: Nose Graze
* Author URI: https://www.nosegraze.com
* License: GPL2
*
<?php
/*
* Plugin Name: Naked Social Share Add-On
* Plugin URI: https://www.nosegraze.com
* Description: Demonstrates how to changes the Font Awesome icons used in Naked Social Share.
* Version: 1.0
* Author: Nose Graze
* Author URI: https://www.nosegraze.com
* License: GPL2
*
@ashleyfae
ashleyfae / date-query-example.php
Created March 24, 2016 13:54
Example WP_Query for posts in a CPT published this month.
<?php
/**
* Example WP_Query for posts in a CPT published this month.
* @link http://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
*/
// Get today's date. We use this to get the current month/year.
$today = getdate();
// Set up our arguments for the WP_Query.
@ashleyfae
ashleyfae / wordpress-custom-excerpt.php
Created March 29, 2016 13:28
Create your own excerpt
<?php
/**
* Create your own custom excerpt for blog posts.
*
* Usage: echo my_custom_excerpt();
* Or, with a modified length: echo my_custom_excerpt( 100 );
*
* @param int $length Desired number of words to display
* @param string $more Characters you want to appear at the end of the excerpt
*
@ashleyfae
ashleyfae / novelist-cover-artist.php
Created April 3, 2016 14:43
Adds a new field in the Novelist plugin for Cover Artist.
<?php
/*
* Plugin Name: Novelist Cover Artist
* Plugin URI: https://novelistplugin.com
* Description: Adds a new field in the Novelist plugin for Cover Artist.
* Version: 1.0
* Author: Nose Graze
* Author URI: https://www.nosegraze.com
* License: GPL2
*