Skip to content

Instantly share code, notes, and snippets.

View corypina's full-sized avatar

Cory Piña corypina

View GitHub Profile
@corypina
corypina / remove-empty-p.php
Last active August 29, 2015 14:26
Wordpress shortcodes will sometimes output empty <p> tags. This plugin will remove them. Source of original code: https://thomasgriffin.io/remove-empty-paragraph-tags-shortcodes-wordpress/
<?php
/*
Plugin Name: Shortcode P-Fixer
Description: Remove empty paragraphs from shortcode output.
*/
/* Original Code from Thomas Griffin
/* https://thomasgriffin.io/remove-empty-paragraph-tags-shortcodes-wordpress/
*/
@corypina
corypina / move-file-to-desktop.applescript
Last active October 7, 2015 07:58
Copy specific file to desktop for attaching to email. I use it for documents I reference or email often.
-- Replace with the file you want to copy
set theFile to "Macintosh HD:Users:path:to:your:file.txt"
-- Replace with the target folder. Or just swap your username in to use the Desktop.
set theDestination to "Macintosh HD:Users:USERNAME:Desktop"
tell application "Finder" to duplicate theFile to theDestination
@corypina
corypina / 0_reuse_code.js
Created December 18, 2015 17:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@corypina
corypina / JounralEntry.applescript
Last active December 19, 2015 17:49
Creates and opens timestamped text file into predetermined folder to be used for any kind of journaling. Example: "2013.07.14.800.txt" with first line reading "July 14, 2013 8:00 AM."
-- Set path to your folder here, including trailing slash and quotes.
set pathtofolder to "~/Dropbox/Write/"
-- Set preferred text editor here, including quotes.
-- Works with TextEdit, TextMate, TextWrangler, and I assume most others.
set myEditor to "Textmate"
-- Assigns bash script to variablle `ss`.
@corypina
corypina / better-popular.php
Last active December 30, 2015 22:49
A Popular Topics query for bbPress. The built in widget will show either 1) recent topics, or 2) topics with the most replies. This queries topics with a minimum number of replies, whose most recent activity ("freshness") is more recent than a variable date (e.g., "1 month ago").
@corypina
corypina / wpml-beaver-build-custom-modules.php
Last active June 20, 2018 21:55
Register fields of custom BB modules into the WPML String Translation interface in WordPress. Add to functions.php, or custom module plugin.
<?php
// Translating custom Beaver Builder Modules with WPML
// Runs a filter included in the WPML String Translation plugin
add_filter( 'wpml_beaver_builder_modules_to_translate', 'wpml_modules_to_translate_filter' );
// Add each custom module to the $modules array, e.g. `custom-module-1`
function wpml_modules_to_translate_filter( $modules ) {
// Adding the first module.
@corypina
corypina / bb-custom-fonts.php
Created September 19, 2018 15:50
Register custom fonts into the Customizer and Page Builder interfaces in Beaver Builder
<?php
/**
* Customizer Custom Fonts
*
* Add fonts to the BB Theme Customizer and BB Page Builder
* Fonts will be listed under "System" fonts in the drop downs
*
* Solution originally found here:
* https://www.warpconduit.net/2016/02/15/adding-custom-fonts-to-the-beaver-builder-child-theme-customizer/
@corypina
corypina / custom-admin-css.php
Created September 20, 2018 17:48
Run custom CSS in WordPress admin screens
<?php
/**
* Add CSS to Events Admin pages
*/
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts() {
// Get current screen if targeting post type is necessary
@corypina
corypina / jump-above-hash.js
Created October 11, 2018 22:17
Jump above the anchor a given amount of pixels on click
window.addEventListener("hashchange", function () {
window.scrollTo(window.scrollX, window.scrollY - 100);
});
@corypina
corypina / custom-admin-notice.php
Created October 18, 2018 00:52
Add a custom admin notice in the WordPress admin
<?php
// This will display native-style admin notice in the WordPress admin area
function displayCustomNotice() { ?>
<div class="notice notice-information">
<p>Your text here!</p>
</div>