Skip to content

Instantly share code, notes, and snippets.

View priscillamc's full-sized avatar

Priscilla Chapman priscillamc

View GitHub Profile
@priscillamc
priscillamc / wp-attachment-links
Created July 17, 2014 22:55
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.
@priscillamc
priscillamc / wp-debug.md
Last active July 18, 2016 05:34
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);
@priscillamc
priscillamc / gitignore
Last active April 22, 2019 06:59
Common gitignore
Thumbs.db
.DS_Store
*.orig
node_modules
.npm-debug.log
@priscillamc
priscillamc / list category post page attachments
Created March 4, 2015 17:19
Shortcode to list page attachments using the WordPress List Category Posts plugin https://wordpress.org/plugins/list-category-posts/
<!-- 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"]
// 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
@priscillamc
priscillamc / git-email-fix
Created April 15, 2015 13:33
Git fix email settings in branch
git config --global user.email
git config --global user.email "username@users.noreply.github.com"
git filter-branch --commit-filter '
if [ "$GIT_AUTHOR_EMAIL" = "email@example.com" ];
then
GIT_AUTHOR_NAME="username";
GIT_AUTHOR_EMAIL="username@users.noreply.github.com";
git commit-tree "$@";
<script type="text/javascript">
jQuery(function($){
// Your jQuery code here, using the $
});
</script>
<?php
/*
Plugin Name: Auto Update
Description: Enables automatic background updates for core, plugins, and themes. See <a href="https://codex.wordpress.org/Configuring_Automatic_Background_Updates" 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' );
@priscillamc
priscillamc / wp-hide-customizer-admin-links
Created August 13, 2015 21:13
Remove WordPress Customizer links from the Admin Toolbar and dashboard by changing the body class back to 'no-customize-support'. This is a way to show only the original admin toolbar links for themes that don't support the Customizer.
<!-- 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>
<div class="eventtitle">
<h4>[link][title][/link]</h4>
[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]