Making WordPress.org

Changeset 15510


Ignore:
Timestamp:
11/06/2026 10:25:21 PM (4 days ago)
Author:
obenland
Message:

WordPress.tv: Use the WordPress.org global footer in wptv-27

Closes ​https://github.com/WordPress/wordpress.org/pull/1203.

Location:
sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv-27
Files:
1 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv-27/functions.php

    r15507 r15510  
    3333require_once WPTV_THEME_DIR . '/inc/publishing.php';
    3434require_once WPTV_THEME_DIR . '/inc/open-graph.php';
     35require_once WPTV_THEME_DIR . '/inc/global-footer.php';
    3536require_once WPTV_THEME_DIR . '/inc/redirects.php';
    3637require_once WPTV_THEME_DIR . '/inc/maintenance.php';
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv-27/inc/setup.php

    r15507 r15510  
    2020        add_editor_style( 'style.css' );
    2121
    22         // Same location names as wptv2, so the assigned menus survive switching between both themes.
     22        // Same location name as wptv2, so the assigned menu survives switching between both themes.
    2323        register_nav_menus(
    2424                array(
    2525                        'primary' => __( 'Primary Menu', 'wptv' ),
    26                         'footer'  => __( 'Footer Menu', 'wptv' ),
    2726                )
    2827        );
    … …  
    8483}
    8584add_filter( 'render_block_data', __NAMESPACE__ . '\primary_menu_links' );
    86 
    87 /**
    88  * Fills the footer "Contribute" list with the classic menu assigned to `footer`.
    89  *
    90  * Only top-level items are shown, as wptv2's footer menu (depth 1). Links to
    91  * other sites get the decorative arrow the footer design uses. Without an
    92  * assigned menu, or with an empty one, the pattern's own links are kept.
    93  *
    94  * @param string $content Rendered List block.
    95  * @param array  $block   Parsed block.
    96  * @return string
    97  */
    98 function footer_menu_links( $content, $block ) {
    99         $classes = preg_split( '/\s+/', $block['attrs']['className'] ?? '' );
    100         if ( ! in_array( 'wptv-footer__contribute', $classes, true ) || ! preg_match( '/^\s*(<ul\b[^>]*>)/', $content, $opening ) ) {
    101                 return $content;
    102         }
    103 
    104         $locations = get_nav_menu_locations();
    105         $menu      = wp_get_nav_menu_object( $locations['footer'] ?? 0 );
    106         $items     = $menu ? wp_get_nav_menu_items( $menu->term_id ) : array();
    107         if ( ! $items ) {
    108                 return $content;
    109         }
    110 
    111         $home_host = wp_parse_url( home_url(), PHP_URL_HOST );
    112         $links     = '';
    113         foreach ( $items as $item ) {
    114                 if ( (int) $item->menu_item_parent ) {
    115                         continue;
    116                 }
    117                 $host   = wp_parse_url( $item->url, PHP_URL_HOST );
    118                 $arrow  = ( $host && $host !== $home_host ) ? ' <span aria-hidden="true">↗</span>' : '';
    119                 $target = $item->target ? ' target="' . esc_attr( $item->target ) . '" rel="noopener"' : '';
    120                 $links .= '<li><a href="' . esc_url( $item->url ) . '"' . $target . '>' . esc_html( $item->title ) . $arrow . '</a></li>';
    121         }
    122 
    123         return $links ? $opening[1] . $links . '</ul>' : $content;
    124 }
    125 add_filter( 'render_block_core/list', __NAMESPACE__ . '\footer_menu_links', 10, 2 );
    12685
    12786/**
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv-27/inc/single.php

    r15507 r15510  
    4141}
    4242add_filter( 'render_block_core/post-excerpt', __NAMESPACE__ . '\\full_description', 10, 3 );
     43
     44// The pattern's Sharing Buttons block replaces Jetpack's classic buttons, which would add two more rows.
     45add_filter( 'sharing_show', '__return_false' );
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv-27/parts/footer.html

    r15507 r15510  
    1 <!-- wp:pattern {"slug":"wptv/footer"} /-->
     1<!-- wp:wptv/global-footer /-->
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv-27/style.css

    r15507 r15510  
    2727.wp-site-blocks main { padding-block: var(--wp--preset--spacing--60); }
    2828.wp-site-blocks main.is-flush { padding-block: 0; }
     29.wp-site-blocks main.wptv-single { padding-block-end: var(--wp--preset--spacing--60); }
    2930:where(.wp-block-group, .wp-block-column, .wp-block-post, .wp-block-query) { min-width: 0; }
    3031:where(input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]), textarea, select) {
    … …  
    7172.wptv-header .is-menu-open .wp-block-navigation-item { padding-block: 12px; border-bottom: 1px solid var(--wp--preset--color--light-grey-1); }
    7273.wptv-header .is-menu-open .wp-block-search { width: 100%; }
    73 .wptv-footer { padding-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--30); font-size: var(--wp--preset--font-size--small); }
    74 .wptv-footer a { color: var(--wp--preset--color--white); text-decoration: none; }
    75 .wptv-footer a:hover { text-decoration: underline; }
    76 .wptv-footer a:focus { outline-color: var(--wp--preset--color--blueberry-2); }
    77 .wptv-footer__heading { font: 600 var(--wp--preset--font-size--small)/1.625 var(--wp--preset--font-family--inter); color: var(--wp--preset--color--white); }
    78 .wptv-footer__columns { gap: 30px; }
    79 .wptv-footer__columns > .wp-block-column:first-child { flex-grow: 2; }
    80 .wptv-footer__links { list-style: none; padding: 0; }
    81 .wptv-footer__links li + li { margin-top: 8px; }
    82 .wptv-footer__license { border-top: 1px solid var(--wp--preset--color--white-opacity-15); margin-top: var(--wp--preset--spacing--40); padding-top: var(--wp--preset--spacing--20); gap: 20px; }
    83 .wptv-footer .wp-block-site-title { font-family: var(--wp--preset--font-family--inter); font-size: var(--wp--preset--font-size--large); }
    84 .wptv-footer__wporg { margin: 0; }
    85 .wptv-footer .wp-block-site-title + p,
    86 .wptv-footer .wptv-footer__wporg + p { margin-block-start: 0; }
    87 .wptv-footer__wporg img { display: block; width: auto; max-width: 100%; height: 27px; }
     74.global-footer a:focus { outline-color: var(--wp--preset--color--blueberry-2); }
     75.global-footer a[href="https://wordpress.tv/"] [aria-hidden="true"] { display: none; }
    8876/* === cards === */
    8977.is-style-cards-grid { gap: var(--wp--preset--spacing--20); }
    … …  
    231219}
    232220@media (max-width: 781px) {
    233         .wptv-footer .wptv-footer__columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    234         .wptv-footer__columns > .wp-block-column:first-child { grid-column: 1 / -1; }
    235221        .wptv-home__section-heading { align-items: start; }
    236222}
Note: See TracChangeset for help on using the changeset viewer.