Skip to content

Instantly share code, notes, and snippets.

View rsharrer's full-sized avatar

Ryan Sharrer rsharrer

View GitHub Profile
@rsharrer
rsharrer / Searchatable.sql
Created March 14, 2015 03:04
search for domain
SELECT * FROM `wp_posts` WHERE `guid` LIKE "http://dev.ceramicartsdaily.org/%" AND `post_type` = 'attachment'
@rsharrer
rsharrer / 0_reuse_code.js
Last active August 29, 2015 14:17
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
@rsharrer
rsharrer / Gravity Forms Formlua.php
Created September 30, 2013 20:42
WP-Functions /Gravity Forms Formlua
//GF Formula
add_filter("gform_calculation_formula", "change_formula", 10, 4);
function change_formula($formula, $field, $form, $lead){
$formula = "18% + " . $formula;
return $formula;
@rsharrer
rsharrer / Replace “Howdy” in Admin Bar.php
Created September 26, 2013 14:00
Replace “Howdy” in Admin Bar
// replace WordPress Howdy in WordPress 3.3
function replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Howdy,', 'Logged in as', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );
@rsharrer
rsharrer / CUSTOMISE ADMIN FOOTER.php
Created September 26, 2013 13:59
CUSTOMIZE ADMIN FOOTER
@rsharrer
rsharrer / Custom add_menu_page with add_submenu_page admin panel.php
Created September 26, 2013 13:58
Custom add_menu_page with add_submenu_page admin panel
//Add Custom Admin Menu Item and Sub Menus
function theme_options_panel(){
add_menu_page('Theme page title', 'Theme menu label', 'manage_options', 'theme-options', 'wps_theme_func');
add_submenu_page( 'theme-options', 'Settings page title', 'Settings menu label', 'manage_options', 'theme-op-settings', 'wps_theme_func_settings');
add_submenu_page( 'theme-options', 'FAQ page title', 'FAQ menu label', 'manage_options', 'theme-op-faq', 'wps_theme_func_faq');
}
add_action('admin_menu', 'theme_options_panel');
function wps_theme_func(){
echo '<div class="wrap"><div id="icon-options-general" class="icon32"><br></div>
<h2>Theme</h2></div>';
@rsharrer
rsharrer / Add bookmark links to the wp_nav_menu.php
Created September 26, 2013 13:57
Add bookmark links to the wp_nav_menu
@rsharrer
rsharrer / Add bookmarks to admin bar using get_bookmarks.php
Created September 26, 2013 13:56
Add bookmarks to admin bar using get_bookmarks
function wps_adminbar_bookmarks() {
global $wp_admin_bar;
$cat = '2'; // define category
$name = 'Bookmarks';
$bookmarks = array();
$bookmarks = get_bookmarks("category=$cat");
if ($bookmarks[0] != '') {
$wp_admin_bar->add_menu( array(
'title' => $name,
'href' => false,
@rsharrer
rsharrer / Prevent direct file access to functions.php
Created September 26, 2013 13:55
Prevent direct file access to functions.php
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'functions.php' == basename($_SERVER['SCRIPT_FILENAME']))
{
die ('No access!');
}
@rsharrer
rsharrer / Remove the screen options tab with screen_options hook.php
Created September 26, 2013 13:55
Remove the screen options tab with screen_options hook
function remove_screen_options(){
return false;
}
add_filter('screen_options_show_screen', 'remove_screen_options');