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_action( | |
'all_admin_notices', | |
function() { | |
$screen = get_current_screen(); | |
if ( 'dashboard' === $screen->base ) { | |
/* Your code goes here */ | |
ob_start(); | |
} | |
}, |
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
import { Path, SVG } from '@wordpress/primitives'; | |
export const PlayHqIcon = () => ( | |
<SVG width="24" height="24" viewBox="0 0 24 24" version="1.1"> | |
<Path fill="#4897D2" d="M23.3,5.4l-0.1,0.8C16.7,2.5,8.8,2.2,2,5.4v0c2.9-2.1,6.2-3.5,9.7-4.1c0.3-0.1,0.6-0.1,0.9-0.1 c3.6-0.5,7.3-0.1,10.8,1.1C23.4,3.3,23.4,4.3,23.3,5.4L23.3,5.4z"/> | |
<Path fill="#9057A3" d="M2,5.4C2,5.4,2,5.4,2,5.4C2,5.5,2,5.4,2,5.4L2,5.4z"/> | |
<Path fill="#9057A3" d="M12.6,1.1c-0.3,0-0.6,0.1-0.9,0.1C8.2,1.9,4.9,3.3,2,5.4C1.9,4.3,1.9,3.3,2,2.2C5.4,1,9,0.7,12.6,1.1z"/> | |
<Path d="M11.9,3.2C8.5,3.2,5.1,4,2,5.4c0,0-0.1,0-0.1,0C1.5,5.7,1,5.9,0.6,6.2c0.4,3.1,1.4,6.1,3,8.8l1-8.2 c0,0,0-0.1,0.1-0.1s0.1-0.1,0.1-0.1h2c0.1,0,0.2,0.1,0.2,0.2l-0.5,3.7c0,0,0,0.1,0.1,0.1h2.6c0,0,0,0,0.1,0c0,0,0,0,0-0.1l0.5-3.7 c0,0,0-0.1,0.1-0.1c0,0,0.1-0.1,0.1-0.1h2c0,0,0.1,0,0.1,0.1c0,0,0,0.1,0,0.1l-1.2,9.6c0,0,0,0.1-0.1,0.1c0,0-0.1,0.1-0.1,0.1h-2 c0,0-0.1,0-0.1-0.1c0,0,0-0.1,0-0.1l0.5-3.8c0,0,0-0.1-0.1-0.1H6.3c0,0-0.1,0-0.1,0.1l-0.6,5.1c1.8,2.2,3.9,4,6.3,5.4 c2.6-1.5,5- |
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 | |
/** | |
* Update `the_posts_pagination()` markup for Bootstrap 4 styles | |
* | |
* Does this monstrosity work? Yes! Should you use it? Probably not. | |
* | |
* @param $markup string Original markup. | |
* @return string Updated markup. | |
*/ | |
function cameronjonesweb_bootstrapify_posts_pagination( $markup ) { |
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"]=> |
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() ); |
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 ); | |
} |
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 ) ) { |
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 ) { |
NewerOlder