Skip to content

Instantly share code, notes, and snippets.

@arelthia
arelthia / log-notices.php
Last active December 16, 2015 00:49
Display Log Notices
*
* Display the admin notices
* Based off of ???
*/
function pt_import_notices() {
global $gpt_log;
if (!empty($gpt_log)) {
@arelthia
arelthia / get_user_level.php
Last active December 16, 2015 00:59
Determines if the specified WLM membership level exists for the current user
/*
* determines if the specified membership level exists for the current user
* returns 0 (level does not match user) or 1 (level matched user)
*accepts string level name
*/
function pp_get_level($culevel){
//get the current user
$current_user = wp_get_current_user();
//get the users id
@arelthia
arelthia / show-tax-terms.php
Created April 10, 2013 03:14
//list terms in a given taxonomy [ppshowtax='' orderby='name' 'style=' ' show_count = '' pad_counts = ' ' hierarchical = ' ' hide_empty= ' ' title_li='View Lessons' title_li=''] //list terms in a given taxonomy [ppshowtax='' orderby='name' 'style=' ' show_count = '' pad_counts = ' ' hierarchical = ' ' hide_empty= ' ' title_li='View Lessons' titl…
//list terms in a given taxonomy [ppshowtax='' orderby='name' 'style=' ' show_count = '' pad_counts = ' ' hierarchical = ' ' hide_empty= ' ' title_li='View Lessons' title_li='']
function pp_show_taxs($atts){
extract( shortcode_atts( array(
'taxonomy' => 'category',
'orderby' => 'name',
'style' => 'list',
'show_count' => 0, // 1 for yes, 0 for no
'pad_counts' => 0, // 1 for yes, 0 for no
'hierarchical' => 1, // 1 for yes, 0 for no
@arelthia
arelthia / ppc4Widget- Content
Last active December 20, 2015 11:29
Per Post CSS for Widget Content
/*
Per Post Custom CSS
This bit of code will add a meta box to the bottom
of every post and page content editor. In that box
you can enter your CSS styling declarations and that
specific CSS style will ONLY be loaded on that individual
page or post.
*/
add_action('admin_menu', 'bb_custom_css_hooks');
add_action('save_post', 'bb_save_custom_css');
@arelthia
arelthia / 0_reuse_code.js
Created December 23, 2013 17:54
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
@arelthia
arelthia / rewritehtaccess
Created December 23, 2013 19:16
Remove php extension
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
@arelthia
arelthia / showfiles
Last active August 29, 2015 13:56
Show clickable files in directory.
<?php
$path = "http://mydomain.com/myfiles"; //Set this to where files are located;
if ($handle = opendir('.')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$fullentry = $path.'/'.$entry;
echo "<a href='".$fullentry."'>".$entry."</a><br />";
}
}
closedir($handle);
@arelthia
arelthia / functions.php
Last active August 29, 2015 14:01
Builder - No Title Extension
<?php
if ( is_admin() )
return;
if ( ! class_exists( 'ExtensionNoTitleLayout' ) ) {
class ExtensionNoTitleLayout {
function ExtensionNoTitleLayout() {
it_classes_load( 'it-file-utility.php' );
$this->_base_url = ITFileUtility::get_url_from_file( dirname( __FILE__ ) );
add_action( 'builder_layout_engine_render', array( &$this, 'change_render_content' ), 0 );
@arelthia
arelthia / awac.css
Last active August 29, 2015 14:03
Style Add Widget After Content Optin Box
.awac-wrapper{
border:1px solid #333;
background:#f3f3f7;
margin-bottom:1em;
padding:.8em
}
.awac{
margin-bottom:.8em
}
.awac .gform_wrapper .gform_footer{
@arelthia
arelthia / cleanstring.js
Created July 16, 2014 17:04
Clean Text Pasted From Microsoft Word
function cleanstring(dirty){
var smartchr = [ "&rsquo;","&lsquo;","&ldquo;","&rdquo;","&ndash;","&mdash;","&hellip;", "&nbsp;", '&bdquo;', '&sbquo;' , '&laquo;','&raquo;', '&lsaquo;', '&rsaquo;'];
var correctchr = ["'", "'", '"', '"', '-', '-', '...', '', '"', "'", '"', '"', "'", "'"];
var thestring = dirty;
var regex;
for (var i = 0; i < smartchr.length; i++) {
regex = new RegExp(smartchr[i], "g");
thestring = thestring.replace(regex, correctchr[i]);
}