Skip to content

Instantly share code, notes, and snippets.

Avatar

Clifford cliffordp

View GitHub Profile
View PageLines LESS Color Variables Demo
.pllessdemo {
.column-2 { border: 2px solid red; }
.row-1 .column-2 { border: none; border-bottom: 2px solid red; }
//
.row-2 .column-2 { background: @pl-base !important; }
.row-3 .column-2 { background: @pl-text !important; }
.row-4 .column-2 { background: @pl-link !important; }
.row-5 .column-2 { background: @pl-background !important; }
.row-6 .column-2 { background: @pl-header !important; }
.row-7 .column-2 { background: @pl-footer !important; }
View only display comments on this author's posts
function wps_get_comment_list_by_user($clauses) {
if (is_admin()) {
global $user_ID, $wpdb;
$clauses['join'] = ", wp_posts";
$clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID";
};
return $clauses;
};
if(!current_user_can('edit_others_posts')) {
add_filter('comments_clauses', 'wps_get_comment_list_by_user');
View Switch code based on multisite Site ID
$current_blog_id = $GLOBALS['blog_id'];
if ($current_blog_id == 1) {
// for site 1
} elseif ($current_blog_id == 2) {
// for site 2
} else {
// for rest of sites
} ?>
View Remove some Yoast SEO stuff
/**
* Remove WordPress SEO (by Yoast) Stuff
*
* These different functions from various sources can come in handy when you manage sites for other people
* and you don't want to give them too much control or you don't want to risk them messing up the settings.
*
*/
// get rid of WordPress SEO metabox - adapted from http://wordpress.stackexchange.com/a/91184/2015
if ( ! is_super_admin() ) {
@cliffordp
cliffordp / partial wp-config.php
Last active Apr 4, 2020
wp-config.php conditional for WP Engine Staging Sites *** Must be placed *after* the 'DOMAIN_CURRENT_SITE' constant is defined (near the bottom of wp-config.php)
View partial wp-config.php
<?php
# WP Engine Staging Sites Rules
### Must be placed *after* the 'DOMAIN_CURRENT_SITE' (for Multisite) or 'WP_SITEURL' (for non-Multisite) constant is defined (near the bottom of Production Server's wp-config.php)
//Multisite
if( defined('DOMAIN_CURRENT_SITE') && preg_match('/.staging.wpengine.com$/', constant('DOMAIN_CURRENT_SITE')) ) {
//Non-Multisite
//if( defined('WP_SITEURL') && preg_match('/.staging.wpengine.com$/', constant('WP_SITEURL')) ) {
@cliffordp
cliffordp / force-ssl-url-scheme.php
Last active Mar 27, 2017 — forked from webaware/force-ssl-url-scheme.php
Get SSL / HTTPS to work properly on WP Engine type hosts. Jason Cohen, Aug 28 05:29 pm (CDT): This is because the SSL processing is done at the front-end caching layer and not at the back-end PHP layer. By the time the request gets back there, the protocol is HTTP again rather than HTTPS. However, WordPress also defines a PHP variable saying whe…
View force-ssl-url-scheme.php
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/cliffordp/6378826
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work. Recommended to me by Jason Cohen of WP Engine on 2013-08-28.
Version: 1.0.0
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
View pagelines-dms-toolbar-customizer.php
<?php
/*
Plugin Name: PageLines DMS Toolbar Customizer
Author: TourKick (Clifford P)
Author URI: http://tourkick.com/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmstoolbarcustomizer
Plugin URI: http://www.pagelinestheme.com/remove-dms-editor-toolbar-items-2/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmstoolbarcustomizer
Description: Removes 'Get More Sections' link from Add To Page panel, removes Theme panel, and removes DMS panel from the DMS editor for non-Administrators (e.g. Editors). <strong>Edit the plugin's file to customize other options.</strong> May also choose to copy code directly into your DMS child theme's functions.php file instead of activating this plugin. <a href="http://www.pagelinestheme.com/dms-editor-lock-down/" target="_blank">http://www.pagelinestheme.com/dms-editor-lock-down/</a> may also be helpful.
License: GPLv2
Version: 1.1.20131105
*/
View check-for-pagelines-dms.php
<?php
if( function_exists('pl_has_editor') ){
//PageLines v3 (DMS) is the current theme
}
if( !function_exists('pl_has_editor') ){
//PageLines v3 (DMS) is NOT the current theme
}
View nofollow-specific-category-link.php
@cliffordp
cliffordp / hide-icon-font-icons-on-ie8-and-below.less
Created Sep 19, 2013
Requires PageLines' "Browser Specific CSS" plugin (for PL Framework)
View hide-icon-font-icons-on-ie8-and-below.less
.ie6,
.ie7,
.ie8 {
i,
[class^="icon-"]:before,
[class*="icon-"]:before {
content: "" !important;
display:none;
}
}