Skip to content

Instantly share code, notes, and snippets.

View adamcapriola's full-sized avatar

Adam Capriola adamcapriola

View GitHub Profile
@adamcapriola
adamcapriola / fancybox-image-links.php
Created January 18, 2019 16:58
Add Fancybox attribute to image links
@adamcapriola
adamcapriola / auto-tag-amazon-links-v1.php
Last active July 15, 2021 09:41
Auto-tag Amazon.com links (v1: Raw)
@adamcapriola
adamcapriola / auto-tag-amazon-links-v2.php
Last active January 18, 2019 18:20
Auto-tag Amazon.com links (v2: Clean)
@adamcapriola
adamcapriola / safari-placeholder-line-height-fix.css
Last active January 18, 2019 19:28
Fix Line Height for Input Placeholders in Safari
.search-form input[type=search] {
line-height: revert;
}
@adamcapriola
adamcapriola / add-save-attachment-source-fields.php
Last active January 19, 2019 17:47
Attachment source fields (add and save)
<?php
/**
* Attachment source fields
* @link https://kaspars.net/?p=3203
* @link https://www.billerickson.net/?p=3555
*
*/
// Add fields
add_filter( 'attachment_fields_to_edit', 'ac_attachment_fields_to_edit_source', 10, 2 );
@adamcapriola
adamcapriola / source-link-captioned-images.php
Last active January 19, 2019 17:23
Filter captioned images to include source link
@adamcapriola
adamcapriola / source-link-non-captioned-images.php
Last active January 19, 2019 17:24
Filter non-captioned images to include source link
@adamcapriola
adamcapriola / source-links-images.css
Last active January 19, 2019 17:46
CSS for images with source links
@adamcapriola
adamcapriola / ac-ajax-save-views.php
Last active October 26, 2021 18:56
Save Jetpack "Site Stats" Pageviews as Post Meta
<?php
/**
* Save Jetpack views as post meta: Process Ajax request
*
*/
add_action( 'wp_ajax_save_views', 'ac_ajax_save_views' );
add_action( 'wp_ajax_nopriv_save_views', 'ac_ajax_save_views' );
function ac_ajax_save_views() {
jQuery(document).ready(function(e) {
e.ajax({
method: "POST",
url: save_views.ajax_url,
data: {
post_id: save_views.post_id,
nonce: save_views.nonce,
action: "save_views"
}
});