Skip to content

Instantly share code, notes, and snippets.

View iamcanadian1973's full-sized avatar

Kyle Rumble iamcanadian1973

View GitHub Profile
<?php
/*
WPFront Notification Bar Plugin
Copyright (C) 2013, WPFront.com
Website: wpfront.com
Contact: [email protected]
WPFront Notification Bar Plugin is distributed under the GNU General Public License, Version 3,
June 2007. Copyright (C) 2007 Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
$folder = '';
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on"){$ssl_set = "s";} else{$ssl_set = "";}
if(isset($folder) && $folder != ''){ $folder = '/' . $folder;}
define('WP_HOME', 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST'].$folder); // no trailing slash
define('WP_SITEURL', 'http'.$ssl_set.'://'.$_SERVER['HTTP_HOST'].$folder); // no trailing slash
<?php
// Add group custom group attribute to check later
add_filter( 'ld_course_list_shortcode_attr_defaults', function( $defaults ) {
$defaults['mygroups'] = null;
return $defaults;
}, 10 );
@iamcanadian1973
iamcanadian1973 / query-vars.php
Last active January 19, 2018 22:31
Query vars
<?php
$activation_key = '';
if( isset( $_GET['activation_key'] ) && ! empty( $_GET['activation_key'] ) ) {
$activation_key = $_GET['activation_key'];
}
if( !empty( $activation_key ) ) {
<?php
/**
* Checks if the the post has excerpt or not
* Code reference: https://wordpress.stackexchange.com/a/52897/12615
*/
//
function wpse_40574_populate_excerpt( $data, $postarr )
{
if( ! isset( $data['news'] ) ) {
<?php
/**
* Load a template part into a template
*
* Makes it easy for a theme to reuse sections of code in a easy to overload way
* for child themes.
*
* Includes the named template part for a theme or if a name is specified then a
* specialised part will be included. If the theme contains no {slug}.php file
<?php
function _s_get_textarea( $text ) {
if( empty( $text ) ) {
return false;
}
return wpautop( $text );
}
@iamcanadian1973
iamcanadian1973 / functions.php
Created June 26, 2017 19:36
Add CSS script to WP admin
<?php
add_action( 'admin_enqueue_scripts', 'load_admin_scripts' );
function load_admin_scripts() {
wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/css/subscriber.css', false, '1.0' );
}
@iamcanadian1973
iamcanadian1973 / functions.php
Created June 26, 2017 19:31
Add CSS to admin
<?php
add_action('admin_head', 'my_custom_styles');
function my_custom_styles() {
echo '<style>
.class-name {
padding: 100px;
}
</style>';