Skip to content

Instantly share code, notes, and snippets.

View cliffordp's full-sized avatar

Clifford cliffordp

View GitHub Profile
@cliffordp
cliffordp / gist-full-link.txt
Created March 6, 2014 18:26
WordPress Gist Shortcode Examples for Jetpack v2.9. More info at http://tourkick.com/2014/least-5-ways-embed-gists-wordpress/
@cliffordp
cliffordp / bitly.php
Created March 13, 2014 15:27
New version of http://wordpress.org/plugins/bitly-shortlinks/ -- should avoid stray shortlinks, has option to verify the assigned shortlink is correct by adding define('BITLY_VERIFY', true); to wp-config.php, and other improvements
<?php
/*
Plugin Name: Bit.ly Shortlinks
Version: 0.3
Plugin URI: http://yoast.com/wordpress/bitly-shortlinks/
Description: Use Bit.ly shortlinks instead of the shortlink WP generates. Works with Bit.ly Pro too, so you can immediately use the right URL.
Author: Joost de Valk
Author URI: http://yoast.com/
*/
@cliffordp
cliffordp / style.less
Created April 5, 2014 14:41
Override display of DMS 2 non-legacy PostLoop: hide .metahead and center featured images
#site .pl-new-loop {
.metahead { //author info
display:none;
}
.hentry {
&.post,
&.multi-post {
padding-left: 0px; //override 100px since hiding .metahead
}
.metamedia { //featured images on archive and single post displays
@cliffordp
cliffordp / dms-makestuffinsidefullwidth.less
Created April 24, 2014 18:43
Change content-width sections inside a DMS Canvas Area to full-width -- http://www.pagelinestheme.com/make-content-width-section-full-width/
// from http://www.pagelinestheme.com/make-content-width-section-full-width/
// overriding dms/dms/less/pl-structure.less
body.display-boxed #site .boxed-wrap .pl-area.makestuffinsidefullwidth .pl-area-wrap > .pl-content {
padding-left: 0px;
padding-right: 0px;
}
body.display-full #site .pl-area.makestuffinsidefullwidth .pl-content {
max-width: none;
}
@cliffordp
cliffordp / functions.php
Created May 3, 2014 13:24
Replace 'PageLines-' prefix for DMS Editor media uploads (from editor/editor.actions.php)
<?php
//from http://www.pagelinestheme.com/remove-customize-dms-editors-media-uploads-prefix/
//replace 'PageLines-' prefix for DMS Editor media uploads (from editor/editor.actions.php)
add_filter( 'pl_up_image_prefix', 'my_pl_upload_prefix');
function my_pl_upload_prefix(){
return ''; //example result: 'filename.png'
//return 'My Keyword - '; //example result: 'My Keyword - filename.jpg'
//return get_bloginfo('name','raw') . ' - '; //example result: 'Site Name - filename.gif'
}
@cliffordp
cliffordp / functions.php
Created May 3, 2014 14:03
Remove display of Karma Counter in DMS 2
<?php
//from http://www.pagelinestheme.com/removing-dms-2-karma-counter/
//remove display of Karma Counter in DMS 2
remove_shortcode( 'pl_karma' );
add_shortcode( 'pl_karma', '__return_false' );
@cliffordp
cliffordp / functions.php
Created May 13, 2014 20:10
Display trackbacks and pingbacks in DMS 2
<?php
// from http://www.pagelinestheme.com/dms-trackbacks-pingbacks/ -- https://github.com/pagelines/DMS/issues/741#issuecomment-42981582
// http://codex.wordpress.org/Function_Reference/wp_list_comments
add_filter( 'pl_list_comments', function() { return array( 'type' => 'all', 'avatar_size' => '60' ); } );
@cliffordp
cliffordp / row-closed-columns.js
Created June 5, 2014 20:55
Adds .row-closed to PageLines DMS Canvas Area section so columns within don't have spacing between columns. CHANGE your jQuery selector. Could choose to add .row-squared instead.
<script>
jQuery(document).ready(function() {
//from http://www.pagelinestheme.com/adding-jquery-code-dms-editor/
//CHANGE the jQuery selectors using your Canvas Area's Section ID
jQuery('#pl_areaukh0pxs .pl-area-wrap .editor-row').addClass('row-closed'); //for when using DMS Editor non-preview mode
jQuery('#pl_areaukh0pxs .pl-area-wrap .row.grid-row').addClass('row-closed'); //for when not
})
</script>
@cliffordp
cliffordp / functions.php
Last active September 23, 2023 06:22
Automatically login a single WordPress user upon arrival to a specific page.
<?php
/**
* Automatically login a single WordPress user upon arrival to a specific page.
*
* Redirect to home page once logged in and prevent viewing of the login page.
* Compatible with WordPress 3.9.1+
* Updated 2014-07-18 to resolve WP_DEBUG notice: "get_userdatabylogin is deprecated since version 3.3! Use get_user_by('login') instead."
* Updated 2019-07-09 to reformat code, pass 2nd parameter to `do_action()`, and hook into priority 1.
*
@cliffordp
cliffordp / functions.php
Last active September 30, 2019 16:25
Adding custom SmugMug domain to oEmbed whitelist in WordPress (simple version)
<?php
// From https://tourkick.com/advice-tips-howto/smugmug-custom-domain-oembed-wordpress/
// Works but full regex version could be used instead: https://gist.github.com/cliffordp/7afaa8700d2a5711e9d6
wp_oembed_add_provider( 'https://media.tourkick.com/*', 'https://api.smugmug.com/services/oembed/' );