Making WordPress.org


Ignore:
Timestamp:
02/26/2015 10:05:12 PM (9 years ago)
Author:
obenland
Message:

WP.org Themes: Display parent theme information on the PHP side.

With the switch away from using the API, we have to manually set the required
fields for our requests. Since wp_parse_args() only parses one level deep,
this is a bit more verbose than usual.

See #745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/content-single.php

    r1278 r1337  
    2323            </div>
    2424
    25             <?php if ( ! empty( get_post()->parent ) ) : ?>
     25            <?php
     26                if ( ! empty( get_post()->post_parent ) ) :
     27                    $parent = get_post( get_post()->post_parent );
     28            ?>
    2629            <div class="theme-notice notice notice-info">
    27                 <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), sprintf( '<a href="/%1$s">%2$s</a>', $theme->parent->slug, $theme->parent->name ) ); ?></p>
     30                <p class="parent-theme"><?php printf( __( 'This is a child theme of %s.' ), sprintf( '<a href="%1$s">%2$s</a>', get_permalink( $parent->ID ), $parent->post_title ) ); ?></p>
    2831            </div>
    2932            <?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.