This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Insert Products | |
* Plugin URI: | |
* Description: | |
* Version: 1.04 | |
* Author: Agus Prasetiyo | |
* Author URI: | |
* License: GPL2 | |
* Created On: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy | |
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup | |
// REGISTER TERM META | |
add_action( 'init', '___register_term_meta_text' ); | |
function ___register_term_meta_text() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function compressHtml($html) { | |
return preg_replace( ['/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'], ['>', '<', '\\1'], $html ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('LANGUAGES_PATH', 'languages/'); | |
define('DEFAULT_LANGUAGE', 'en'); | |
define('LANGUAGE_COOKIE_TIME', 1314000 ); // 3600 * 365 = 1314000; (1 year) | |
define('COOKIE_DOMAIN', '.xaviesteve.com'); | |
/* | |
Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooPAM: Woo Product Attributes Modifier | |
* Description: Bulk update 'custom meta product attributes' to 'taxonomy product attributes' in WooCommerce. Supports the GET variables, like: woopam_mode=run&woopam_from_attribute_meta=colour&woopam_to_attribute_tax=pa_colour&woopam_keep_attribute_meta&woopam_posts_per_page=10&woopam_paged=0&woopam_post_type=product&woopam_post_status=any. WARNING: Backup DB first!!! | |
* Plugin Author: birgire | |
* Author URI: https://github.com/birgire | |
* Plugin URI: https://gist.github.com/birgire/0ed300ae4436fcaf508c | |
* Version: 1.0.0 | |
* License: GPL2+ | |
* Text Domain: woopam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Don't include the opening tag | |
function html5_insert_image( $html, $id, $caption, $title, $align, $url, $size, $alt ) { | |
$src = wp_get_attachment_image_src( $id, $size, false ); | |
$html5 = "<figure id=\"post-$id media-$id\" class=\"align-$align\">"; | |
if ( $url ) { | |
$html5 .= "<a href=\"$url\" class=\"image-link\"><img src=\"$src[0]\" alt=\"$alt\" /></a>"; | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('GEOIP_CACHE_TIME', 5184000); // 5184000 = 60 days | |
/** | |
* Returns the country of an IP address | |
* If IP is cached and less than 2 months old, otherwhise requests it to geoplugin.com API | |
* | |
* @string $ip The IP address | |
* @bool $justcountry If you want the full array or just the country |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress" | |
// ... | |
// register and enqueue loadCSS | |
function load_scripts_and_styles() { | |
// register loadCSS | |
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Name Of The Plugin | |
* Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates | |
* Description: A brief description of the Plugin. | |
* Version: The Plugin's Version Number, e.g.: 1.0 | |
* Author: Name Of The Plugin Author | |
* Author URI: http://URI_Of_The_Plugin_Author | |
* License: A "Slug" license name e.g. GPL2 | |
*/ |
NewerOlder