A Lightweight and easy-to-use WordPress Options Framework. It is a free framework for building theme options. Save your time!
Read the documentation for details documentation
<?php | |
/** | |
* This function uploads from a URL. | |
* To upload from a local file path instead | |
* @see: https://gist.github.com/RadGH/3b544c827193927d1772 | |
* | |
* Example usage: Upload photo from URL, display the attachment as as html <img> | |
* $attachment_id = rs_upload_from_url( "http://example.com/images/photo.png" ); | |
* echo wp_get_attachment_image( $attachment_id, 'large' ); |
A Lightweight and easy-to-use WordPress Options Framework. It is a free framework for building theme options. Save your time!
Read the documentation for details documentation
/** | |
* Check if a given ip is in a network | |
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1 | |
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed | |
* @return boolean true if the ip is in this range / false if not. | |
*/ | |
function ip_in_range( $ip, $range ) { | |
if ( strpos( $range, '/' ) == false ) { | |
$range .= '/32'; | |
} |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/(.*)$ | |
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads/%1 !-f | |
RewriteRule ^wp-content/uploads/(.*)$ http://www.remotesite.com/wp-content/uploads/$1 [R=301,L] | |
</IfModule> |
<?php | |
/* | |
* Plugin Name: Paulund WP List Table Example | |
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area | |
* Plugin URI: http://www.paulund.co.uk | |
* Author: Paul Underwood | |
* Author URI: http://www.paulund.co.uk | |
* Version: 1.0 | |
* License: GPL2 | |
*/ |
<script type="text/javascript"> | |
var arr = [ | |
{ "ID": 135, "Name": "Fargo Chan", "Address": "34, Baker Street" }, | |
{ "ID": 432, "Name": "Aaron Luke", "Address": "BLDG 1, J Street" }, | |
{ "ID": 252, "Name": "Dilip Singh", "Address": "Hotel J, SE" } | |
]; | |
// Before Sorting | |
document.write("<b>Before Sorting </b><br/>"); | |
for (var n = 0; n < arr.length; n++) { |
// Get The Page ID You Need | |
get_option( 'woocommerce_shop_page_id' ); | |
get_option( 'woocommerce_cart_page_id' ); | |
get_option( 'woocommerce_checkout_page_id' ); | |
get_option( 'woocommerce_pay_page_id' ); | |
get_option( 'woocommerce_thanks_page_id' ); | |
get_option( 'woocommerce_myaccount_page_id' ); | |
get_option( 'woocommerce_edit_address_page_id' ); | |
get_option( 'woocommerce_view_order_page_id' ); | |
get_option( 'woocommerce_terms_page_id' ); |
<?php | |
// Based on <https://github.com/mecha-cms/extend.minify> | |
define('MINIFY_STRING', '"(?:[^"\\\]|\\\.)*"|\'(?:[^\'\\\]|\\\.)*\''); | |
define('MINIFY_COMMENT_CSS', '/\*[\s\S]*?\*/'); | |
define('MINIFY_COMMENT_HTML', '<!\-{2}[\s\S]*?\-{2}>'); | |
define('MINIFY_COMMENT_JS', '//[^\n]*'); | |
define('MINIFY_PATTERN_JS', '\b/[^\n]+?/[gimuy]*\b'); | |
define('MINIFY_HTML', '<[!/]?[a-zA-Z\d:.-]+[\s\S]*?>'); |
<?php | |
/** | |
* Adding Custom post type counts in 'Right now' Dashboard widget. | |
* Acording this changes : | |
* - https://core.trac.wordpress.org/ticket/26571 | |
* - https://core.trac.wordpress.org/ticket/26495 | |
* now you can't use 'right_now_*' action API to show your custom post type count from your Dashboard. | |
* But if you running WP 3.8 or above, you can use 'dashboard_glance_items' instead. | |
* | |
* @package Wordpress |
<?php | |
/* wp_signon can only be executed before anything is outputed in the page because of that we're adding it to the init hook */ | |
global $wppb_login; | |
$wppb_login = false; | |
function wppb_signon(){ | |
global $error; | |
global $wppb_login; | |