View demos.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 | |
/* Returns: | |
array(5) { | |
["red"]=> | |
string(3) "Red" | |
["green"]=> | |
string(5) "Green" | |
["purple"]=> | |
string(6) "Purple" | |
["blue"]=> |
View kofi-user-contactmethod.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 | |
add_filter( 'user_contactmethods', 'add_kofi_user_contactmehod' ); | |
function add_kofi_user_contactmehod( $methods ) { | |
$methods['kofi'] = 'Ko-fi Username'; | |
return $methods; | |
} | |
function create_kofi_button_from_user_meta() { | |
$kofi = get_the_author_meta( 'kofi', get_the_author_ID() ); |
View get-excerpt-by-id.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 | |
/** | |
* Get the excerpt of a post by it's ID | |
* | |
* @param int $post_id Post ID. | |
* @return string | |
*/ | |
function cameronjonesweb_get_excerpt_by_id( $post_id ) { | |
return apply_filters( 'get_the_excerpt', wp_trim_excerpt( get_post_field( 'post_excerpt', $post_id ), $post_id ), $post_id ); | |
} |
View cameronjonesweb-create-admin.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 | |
/** | |
* Create an admin user | |
*/ | |
function cameronjonesweb_create_admin_user() { | |
$username = 'username'; | |
$password = 'password'; | |
$email = 'email@example.com'; | |
if ( ! username_exists( $username ) && ! email_exists( $email ) ) { |
View add-slug-wocommerce-csv-export.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 | |
/** | |
* Add the custom column to the exporter and the exporter column menu. | |
* | |
* @link https://github.com/woocommerce/woocommerce/wiki/Product-CSV-Importer-&-Exporter#adding-custom-export-columns-developers | |
* | |
* @param array $columns. | |
* @return array $columns. | |
*/ | |
function cameronjonesweb_add_export_columns( $columns ) { |
View 404-fix.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 | |
function cameronjonesweb_404_fix() { | |
global $wp_query; | |
if ( $wp_query->is_404 ) { | |
$wp_query->posts = array(); | |
$wp_query->current_post = 0; | |
$wp_query->post = null; | |
} | |
} |
View cameronjonesweb-wordpress-jquery-fix.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 | |
function cameronjonesweb_jquery_fix() { | |
// Restore old jQuery. | |
wp_deregister_script( 'jquery' ); | |
wp_deregister_script( 'jquery-core' ); | |
wp_register_script( 'jquery-core', get_template_directory_uri() . '/includes/js/jquery-1.12.4.min.js', array(), '1.12.4', false ); | |
wp_register_script( 'jquery', false, array( 'jquery-core' ), null, false ); | |
wp_enqueue_script( 'jquery' ); | |
} |
View cameronjonesweb-delete-default-options.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 | |
/** | |
* Delete the option setting for the default category | |
* | |
* @link https://cameronjonesweb.com.au/blog/how-to-remove-the-uncategorised-category-from-wordpress-and-woocommerce | |
*/ | |
function cameronjonesweb_delete_default_category_option() { | |
if ( get_option( 'default_category' ) ) { | |
delete_option( 'default_category' ); | |
} |
NewerOlder