Skip to content

Instantly share code, notes, and snippets.


Priscilla Chapman priscillamc

View GitHub Profile
priscillamc / wp-attachment-links
Created Jul 17, 2014
WordPress snippet. Link images and documents to the file instead of the attachment page. This also changes the 'View' link in the Media Library admin screen. Add to a new plugin file or to the functions.php in your theme.
View wp-attachment-links
priscillamc / list category post page attachments
Created Mar 4, 2015
Shortcode to list page attachments using the WordPress List Category Posts plugin
View list category post page attachments
<!-- Replace CURRENT_PAGE_ID for the post_parent to only display attachments of a certain page -->
[catlist post_type="attachment" post_parent="CURRENT_PAGE_ID" numberposts=-1 post_status="publish,inherit" orderby="title" order="ASC" no_posts_text="No files found"]
View custom plugin templates
// Use custom template pages in a WordPress plugin
function my_cpt_templates( $template_path ){
// Change template for CPT single pages
if( is_singular('my_cpt') ){
$template_path = plugin_dir_path( __FILE__ ) . 'templates/single-cpt.php';
// Change template for CPT archive pages for a certain taxonomy
View wp-auto-update-plugins-themes
Plugin Name: Auto Update
Description: Enables automatic background updates for core, plugins, and themes. See <a href="" target="_blank">Configuring Automatic Background Updates</a> for more details.
Version: 1.0.0
// Enable automatic updates for core major releases
add_filter( 'allow_major_auto_core_updates', '__return_true' );
View wp-simcal-gce-widget
<!-- Simple Calendar 3.0.4 - UF Template -->
<div class="event item">
<div class="eventdate event-date">
<div class="month">[start-date format="M"]</div>
<div class="day">[start-date format="j"]</div>
<div class="eventtitle">
[if-whole-day]<div class="time">All Day</div>[/if-whole-day]
[if-not-whole-day]<div class="time">[start-date format="g:i A"] - [end-date format="g:i A"]</div>[/if-not-whole-day]
View bookmarks
# Bootstrap
# WordPress
View wp-conditional-styles
* Add styles and scripts to a WordPress site
* See
function my_scripts_styles(){
global $wp_styles;
// Load IE version-specific stylesheets
wp_enqueue_style( 'html5shiv', '', array(), '3.7.2', 'screen' );

Add menus to a WordPress Theme

In functions.php, register menus:

function theme_setup() {
    register_nav_menus( array(
		'main_menu' => esc_html__( 'Main Menu', 'theme' ),
	) );
priscillamc /
Last active Jul 18, 2016
Enable WordPress debugging mode

How to Enable Debug Mode in WordPress

  1. Open wp-config.php and comment out line: define('WP_DEBUG', false);

  2. Paste in the lines below to enable WP_DEBUG mode. This will create a debug.log file in the wp-content folder. Rememeber to turn off debugging when you've finished.

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);

SVG Notes

To create the CSS from a Photoshop template file:

  • For any non-shape layers (including text layers), make a copy. Right-click the copied layer and click 'Convert to Shape'
  • The converted Department Name shape layer should be renamed to "Unit Text"
  • If a shape should have a default color, set the color.
  • Rename layers if needed. The layer name becomes the path id in the svg.
  • Hide layers that don't need to be exported as paths.
  • Select the layers that should be exported. (Bar, Logo, Parent Unit Text, Unit Text)