qsdklsqkdmqskdmlqskd
azoepqikdomlqskdjmlqs
qpfklqjsfmklqsjdmqlsjdsqd
icon-functions.php 0000666 00000007415 15233123043 0010222 0 ustar 00 theme_location ) {
$svg = twentynineteen_get_social_link_svg( $item->url, 32 );
if ( empty( $svg ) ) {
$svg = twentynineteen_get_icon_svg( 'link' );
}
$item_output = str_replace( $args->link_after, '' . $svg, $item_output );
}
return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'twentynineteen_nav_menu_social_icons', 10, 4 );
/**
* Adds a dropdown icon to top-level menu items.
*
* @param string $item_output The menu item's starting HTML output.
* @param WP_Post $item Menu item data object.
* @param int $depth Depth of the menu. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
* @return string Nav menu item start element.
*/
function twentynineteen_add_dropdown_icons( $item_output, $item, $depth, $args ) {
// Only add class to 'top level' items on the 'primary' menu.
if ( ! isset( $args->theme_location ) || 'menu-1' !== $args->theme_location ) {
return $item_output;
}
if ( in_array( 'mobile-parent-nav-menu-item', $item->classes, true ) && isset( $item->original_id ) ) {
// Inject the keyboard_arrow_left SVG inside the parent nav menu item, and let the item link to the parent item.
// @todo Only do this for nested submenus? If on a first-level submenu, then really the link could be "#" since the desire is to remove the target entirely.
$link = sprintf(
'',
$item_output,
1 // Limit.
);
} elseif ( in_array( 'menu-item-has-children', $item->classes, true ) ) {
// Add SVG icon to parent items.
$icon = twentynineteen_get_icon_svg( 'keyboard_arrow_down', 24 );
$item_output .= sprintf(
'%s',
$icon
);
}
return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'twentynineteen_add_dropdown_icons', 10, 4 );
back-compat.php 0000666 00000004707 15233123043 0007446 0 ustar 00
%s
',
sprintf(
/* translators: %s: WordPress version. */
__( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ),
$GLOBALS['wp_version']
)
);
}
/**
* Prevents the Customizer from being loaded on WordPress versions prior to 4.7.
*
* @since Twenty Nineteen 1.0.0
*
* @global string $wp_version WordPress version.
*/
function twentynineteen_customize() {
wp_die(
sprintf(
/* translators: %s: WordPress version. */
__( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ),
$GLOBALS['wp_version']
),
'',
array(
'back_link' => true,
)
);
}
add_action( 'load-customize.php', 'twentynineteen_customize' );
/**
* Prevents the Theme Preview from being loaded on WordPress versions prior to 4.7.
*
* @since Twenty Nineteen 1.0.0
*
* @global string $wp_version WordPress version.
*/
function twentynineteen_preview() {
if ( isset( $_GET['preview'] ) ) {
wp_die(
sprintf(
/* translators: %s: WordPress version. */
__( 'Twenty Nineteen requires at least WordPress version 4.7. You are running version %s. Please upgrade and try again.', 'twentynineteen' ),
$GLOBALS['wp_version']
)
);
}
}
add_action( 'template_redirect', 'twentynineteen_preview' );
helper-functions.php 0000666 00000010136 15233123043 0010543 0 ustar 00 user_id > 0 ) {
$user = get_userdata( $comment->user_id );
$post = get_post( $comment->comment_post_ID );
if ( ! empty( $user ) && ! empty( $post ) ) {
return $comment->user_id === $post->post_author;
}
}
return false;
}
/**
* Returns information about the current post's discussion, with cache support.
*/
function twentynineteen_get_discussion_data() {
static $discussion, $post_id;
$current_post_id = get_the_ID();
if ( $current_post_id === $post_id ) {
return $discussion; /* If we have discussion information for post ID, return cached object */
} else {
$post_id = $current_post_id;
}
$comments = get_comments(
array(
'post_id' => $current_post_id,
'orderby' => 'comment_date_gmt',
'order' => get_option( 'comment_order', 'asc' ), /* Respect comment order from Settings » Discussion. */
'status' => 'approve',
'number' => 20, /* Only retrieve the last 20 comments, as the end goal is just 6 unique authors */
)
);
$authors = array();
foreach ( $comments as $comment ) {
$authors[] = ( (int) $comment->user_id > 0 ) ? (int) $comment->user_id : $comment->comment_author_email;
}
$authors = array_unique( $authors );
$discussion = (object) array(
'authors' => array_slice( $authors, 0, 6 ), /* Six unique authors commenting on the post. */
'responses' => get_comments_number( $current_post_id ), /* Number of responses. */
);
return $discussion;
}
/**
* Converts HSL to HEX or RGB colors.
*
* @param float $h The hue component (0-360).
* @param float $s The saturation component (0-100).
* @param float $l The lightness component (0-100).
* @param bool $to_hex Whether to convert to HEX format (true) or RGB (false). Default true.
*/
function twentynineteen_hsl_hex( $h, $s, $l, $to_hex = true ) {
$h /= 360;
$s /= 100;
$l /= 100;
$r = $l;
$g = $l;
$b = $l;
$v = ( $l <= 0.5 ) ? ( $l * ( 1.0 + $s ) ) : ( $l + $s - $l * $s );
if ( $v > 0 ) {
$m = $l + $l - $v;
$sv = ( $v - $m ) / $v;
$h *= 6.0;
$sextant = floor( $h );
$fract = $h - $sextant;
$vsf = $v * $sv * $fract;
$mid1 = $m + $vsf;
$mid2 = $v - $vsf;
switch ( $sextant ) {
case 0:
$r = $v;
$g = $mid1;
$b = $m;
break;
case 1:
$r = $mid2;
$g = $v;
$b = $m;
break;
case 2:
$r = $m;
$g = $v;
$b = $mid1;
break;
case 3:
$r = $m;
$g = $mid2;
$b = $v;
break;
case 4:
$r = $mid1;
$g = $m;
$b = $v;
break;
case 5:
$r = $v;
$g = $m;
$b = $mid2;
break;
}
}
$r = round( $r * 255, 0 );
$g = round( $g * 255, 0 );
$b = round( $b * 255, 0 );
if ( $to_hex ) {
$r = ( $r < 15 ) ? '0' . dechex( $r ) : dechex( $r );
$g = ( $g < 15 ) ? '0' . dechex( $g ) : dechex( $g );
$b = ( $b < 15 ) ? '0' . dechex( $b ) : dechex( $b );
return "#$r$g$b";
}
return "rgb($r, $g, $b)";
}
template-functions.php 0000666 00000021253 15233123043 0011101 0 ustar 00 ';
}
}
add_action( 'wp_head', 'twentynineteen_pingback_header' );
/**
* Changes comment form default fields.
*
* @param array $defaults The default comment form arguments.
*/
function twentynineteen_comment_form_defaults( $defaults ) {
$comment_field = $defaults['comment_field'];
// Adjust height of comment form.
$defaults['comment_field'] = preg_replace( '/rows="\d+"/', 'rows="5"', $comment_field );
return $defaults;
}
add_filter( 'comment_form_defaults', 'twentynineteen_comment_form_defaults' );
/**
* Filters the default archive titles.
*/
function twentynineteen_get_the_archive_title() {
if ( is_category() ) {
$title = __( 'Category Archives: ', 'twentynineteen' ) . '' . single_term_title( '', false ) . '';
} elseif ( is_tag() ) {
$title = __( 'Tag Archives: ', 'twentynineteen' ) . '' . single_term_title( '', false ) . '';
} elseif ( is_author() ) {
$title = __( 'Author Archives: ', 'twentynineteen' ) . '' . get_the_author_meta( 'display_name' ) . '';
} elseif ( is_year() ) {
$title = __( 'Yearly Archives: ', 'twentynineteen' ) . '' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentynineteen' ) ) . '';
} elseif ( is_month() ) {
$title = __( 'Monthly Archives: ', 'twentynineteen' ) . '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentynineteen' ) ) . '';
} elseif ( is_day() ) {
$title = __( 'Daily Archives: ', 'twentynineteen' ) . '' . get_the_date() . '';
} elseif ( is_post_type_archive() ) {
$title = __( 'Post Type Archives: ', 'twentynineteen' ) . '' . post_type_archive_title( '', false ) . '';
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
/* translators: %s: Taxonomy singular name. */
$title = sprintf( esc_html__( '%s Archives:', 'twentynineteen' ), $tax->labels->singular_name );
} else {
$title = __( 'Archives:', 'twentynineteen' );
}
return $title;
}
add_filter( 'get_the_archive_title', 'twentynineteen_get_the_archive_title' );
/**
* Adds custom 'sizes' attribute to responsive image functionality for post thumbnails.
*
* @since Twenty Nineteen 1.0
*
* @param string[] $attr Array of attribute values for the image markup, keyed by attribute name.
* See wp_get_attachment_image().
* @return string[] The filtered attributes for the image markup.
*/
function twentynineteen_post_thumbnail_sizes_attr( $attr ) {
if ( is_admin() ) {
return $attr;
}
if ( ! is_singular() ) {
$attr['sizes'] = '(max-width: 34.9rem) calc(100vw - 2rem), (max-width: 53rem) calc(8 * (100vw / 12)), (min-width: 53rem) calc(6 * (100vw / 12)), 100vw';
}
return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'twentynineteen_post_thumbnail_sizes_attr' );
/**
* Adds an extra menu to our nav for our priority+ navigation to use.
*
* @param string $nav_menu Nav menu.
* @param object $args Nav menu args.
* @return string More link for hidden menu items.
*/
function twentynineteen_add_ellipses_to_nav( $nav_menu, $args ) {
if ( 'menu-1' === $args->theme_location ) :
$nav_menu .= '
' . esc_html__( 'Eva Young grew up working alongside her parents at their restaurant in Queens, NY. She opened Eva Young Consulting in 2014 to help small businesses like her parents’ restaurant adapt to the digital age.', 'twentynineteen' ) . '
' . esc_html__( 'Oddly enough, Doug Watson also grew up working alongside his parents at a family-owned restaurant in Queens, NY. He worked on digital campaigns for Fortune 500 Companies before joining Eva Green Consulting.', 'twentynineteen' ) . '