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
<?php | |
add_filter( 'nav_menu_link_attributes','cameronjonesweb_move_custom_menu_item_class_to_anchor_element', 10, 4 ); | |
add_filter( 'nav_menu_css_class', 'cameronjonesweb_remove_custom_menu_item_class_from_li_element', 10, 4 ); | |
/** | |
* Get the custom item menu classes and add them to the anchor element | |
* | |
* @link https://cameronjonesweb.com.au/blog/how-to-move-the-custom-menu-item-classes-to-the-anchor-element/ | |
* @param array $atts The HTML attributes applied to the menu item's `<a>` element, empty strings are ignored. |
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
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wordcampsc_link_colour', array( | |
'label' => __( 'Link Colour', 'wordcampsc' ), | |
'section' => 'colors', | |
) ) ); |
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 | |
/** | |
* A custom WP_Query object that will always be empty | |
*/ | |
$query = new WP_Query( array( | |
'post__in' => array( 0 ) | |
) ); |
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 | |
/** | |
* 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
function scrollToAnchor( $headers ) { | |
jQuery( 'a[href^="#"]' ).each( function() { | |
if ( jQuery( this ).attr( 'href' ).length > 1 ) { | |
if ( jQuery( 'body' ).find( jQuery( this ).attr( 'href' ) ) ) { | |
jQuery( this ).click( function( e ){ | |
e.preventDefault(); | |
$offset = 0; | |
for ( i = 0; i < $headers.length; i++ ) { | |
if ( jQuery( $headers[ i ] ).length ) { | |
$offset += jQuery( $headers[ i ] ).outerHeight(); |
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"]=> |
NewerOlder