This file contains 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 | |
/** | |
* @file | |
* Integration layer to communicate with the Envato API. | |
* | |
* @see https://build.envato.com/api | |
* | |
* @outher Abdullah Sowailem. | |
*/ |
This file contains 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 | |
/** | |
* Add Extra Code to Any Menu | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/customizing-wordpress-menus/ | |
* | |
* @param string $menu | |
* @param object $args | |
* @return string modified menu | |
*/ |
This file contains 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 | |
/** | |
* Remove Genesis Page Templates | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/remove-genesis-page-templates | |
* | |
* @param array $page_templates | |
* @return array |
This file contains 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 | |
// MyShortcode usage [myshortcode greeting="Hello" who="World"] | |
function myshortcode_func( $atts, $content = null ) { | |
// use given attributes or defined defaults | |
extract( shortcode_atts( array( | |
'greeting' => '', | |
'who' => '' | |
), $atts ) ); |
This file contains 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 | |
// To be used by theme authors to avoid duplicate favicon code now that Site Icons have been added to WordPress 4.3 | |
// If a Site Icon hasn't been set or if the `has_site_icon` function doesn't exist (ie older than WordPress 4.3) | |
if ( ! ( function_exists( 'has_site_icon' ) && has_site_icon() ) ) { | |
// your theme specific custom favicon code goes here | |
} |
This file contains 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
// proof-of-concept to extract all WordPress Gutenberg's blocks as array | |
// author: Frank Goossens (Futta) | |
// source: https://blog.futtta.be/2018/01/25/how-to-extract-blocks-from-gutenberg/ | |
add_action('the_content','gutenprint',10,1); | |
function gutenprint($html) { | |
// check if we need to and can load the Gutenberg PEG parser | |
if ( !class_exists("Gutenberg_PEG_Parser") && file_exists(WP_PLUGIN_DIR."/gutenberg/lib/load.php") ) { | |
include_once(WP_PLUGIN_DIR."/gutenberg/lib/load.php"); | |
} |
This file contains 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 | |
if ( is_shop() || is_product_category() || is_product_tag() ) { // Only run on shop archive pages, not single products or other pages | |
// Products per page | |
$per_page = 24; | |
if ( get_query_var( 'taxonomy' ) ) { // If on a product taxonomy archive (category or tag) | |
$args = array( |
This file contains 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
# Create directory for new site | |
cd ~/Sites | |
mkdir {query} | |
cd {query} | |
# Download latest version of WordPress | |
wp core download | |
# Setup wp-config file with WP_DEBUG enabled | |
wp core config --dbname={query} --dbuser=root --dbpass=root --dbprefix={query}wp_ --extra-php <<PHP |
This file contains 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
# Rewritten code from /r2/r2/lib/db/_sorts.pyx | |
from math import sqrt | |
def _confidence(ups, downs): | |
n = ups + downs | |
if n == 0: | |
return 0 | |
z = 1.281551565545 |
This file contains 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 | |
/** | |
* wc_direct_link_to_product_tabs | |
* | |
* Allows you to create custom URLs to activate product tabs by default, directly from the URL | |
* ex: http://mysite.com/my-product-name#reviews | |
*/ | |
function wc_direct_link_to_product_tabs() { | |
if( is_product() ) { | |
?> |
OlderNewer