Skip to content

Instantly share code, notes, and snippets.

View EvanHerman's full-sized avatar
🐈
Cats, Code, WordPress

Evan Herman EvanHerman

🐈
Cats, Code, WordPress
View GitHub Profile
@EvanHerman
EvanHerman / wp-admin-table-markup.html
Last active August 8, 2020 07:32
WordPress Dashboard Admin Table Markup
<table class="widefat fixed" cellspacing="0">
<thead>
<tr>
<th id="cb" class="manage-column column-cb check-column" scope="col"></th> <!-- this column contains checkboxes -->
<th id="columnname" class="manage-column column-columnname" scope="col"></th>
<th id="columnname" class="manage-column column-columnname num" scope="col"></th> <!-- "num" added because the column contains numbers -->
</tr>
</thead>
@EvanHerman
EvanHerman / export-database-table-to-csv.php
Last active February 19, 2016 19:51
Export a database table to .CSV. Usage example found at the bottom of this file.
<?php
/**
* Export Class to help export a given database table to CSV.
*/
class TOOL_EXPORT_CLASS {
/*
* Export our forms
* @parameters
* @table_name the name of the table to export
@EvanHerman
EvanHerman / enqueue_parent_styles_and_animate_css.php
Last active March 2, 2016 21:47
Enqueue Parent Theme Style + Animate.css from child theme root
<?php
add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );
function my_enqueue_assets() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'animate-css', get_stylesheet_directory_uri() . '/animate.min.css' );
}
@EvanHerman
EvanHerman / custom-interior-image-timeline-express.php
Created May 18, 2016 21:54
Use a different image on the single announcement page, than what is used on the timeline.
/**
* Timeline Express Add Custom Metabox
* @param array $options Array of options for Timeline Express.
*/
function define_custom_excerpt_metabox( $options ) {
$announcement_custom_metabox = new_cmb2_box( array(
'id' => 'custom_meta',
'title' => __( 'Additional Announcement Meta', 'text-domain' ),
'object_types' => array( 'te_announcements' ), // Post type
'context' => 'advanced',
@EvanHerman
EvanHerman / custom-function.php
Last active February 9, 2018 16:36
Timeline Express - Enable Announcement Date & Time Pickers
<?php
/**
* Add date/time picker field to Timeline Express announcements
*
* @param array $custom_field Array of custom fields to append to our announcements.
*/
function add_custom_fields_to_announcements( $custom_fields ) {
$custom_fields[] = array(
'name' => esc_html__( 'Announcement Date & Time', 'text-domain' ),
@EvanHerman
EvanHerman / custom-read-more-text.php
Last active September 20, 2019 02:30
Timeline Express Custom Read More Text
<?php // Do not include this line - this is here for syntax highlighting only
/**
* Alter the read more text on the timeline
*
* @param string $text The read more link text.
* @param integer $post_id The post ID.
*
* @return string The final read more link text.
*/
@EvanHerman
EvanHerman / gist:dfd2a8c4f2f129b65a54344a97ffd80e
Created December 17, 2016 19:08 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@EvanHerman
EvanHerman / update-user-by-email.php
Created January 31, 2017 13:59
Update WordPress user password by email address
<?php
/**
* Update an existing user by email address
*
* @author Code Parrots <[email protected]>
*/
function update_user_password_by_email() {
$user = get_user_by( 'email', '[email protected]' );
@EvanHerman
EvanHerman / dynamic-post-tags.php
Last active May 3, 2017 12:43
Populate the WordPress post tags with the values from the WordPress post categories on the save_post action hook.
<?php
/**
* Dynamically set the post tags to mirror the post categories.
*
* @action save_post
*
* @param integer $post_id The post ID.
*/
function dynamic_post_tags( $post_id ) {
@EvanHerman
EvanHerman / circle.yml
Created August 24, 2017 17:49 — forked from Arjeno/circle.yml
Always use the latest version of Chrome on CircleCI
# This makes sure Chrome is always up to date in your test suite
# On average this adds about 10 seconds to your build suite
# Be sure to use Ubuntu 14.04 (Trusty) in the CircleCI's OS setting (Settings > Build Environment)
dependencies:
pre:
- curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome.deb
- sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
- rm google-chrome.deb