Making WordPress.org


Ignore:
Timestamp:
02/06/2024 02:10:30 AM (12 months ago)
Author:
dufresnesteven
Message:

Support Forum: Add theme screenshot to forum.

Props: renyot.

Closes: #7437

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-theme-directory-compat.php

    r12411 r13176  
    127127        }
    128128
     129        $icon       = '';
    129130        $theme      = sprintf( '<a href="//wordpress.org/themes/%s/">%s</a>', esc_attr( $this->slug() ), esc_html( $this->theme->post_title ) );
    130131        $support    = sprintf( '<a href="%s">%s</a>', home_url( '/theme/' . esc_attr( $this->slug() ) . '/' ), __( 'Support Threads', 'wporg-forums' ) );
     
    145146            $create = sprintf( '<a href="#new-post">%s</a>', $create_label );
    146147        }
     148
     149        if ( file_exists( WPORGPATH . 'wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php' ) ) {
     150            include_once WPORGPATH . 'wp-content/plugins/theme-directory/class-wporg-themes-repo-package.php';
     151       
     152            if ( class_exists( 'WPORG_Themes_Repo_Package' ) ) {
     153                switch_to_blog( WPORG_THEME_DIRECTORY_BLOGID );
     154                $repo_package = new \WPORG_Themes_Repo_Package( $this->theme->ID );
     155                $icon = $repo_package->screenshot_url();
     156                restore_current_blog();
     157            }
     158        }
     159
    147160        ?>
    148161        <div>
    149162            <ul>
     163                <?php if ( ! empty( $icon ) ) : ?>
     164                    <li class="theme-meta-icon"><img src="<?php echo esc_url( $icon ); ?>"></li>
     165                <?php endif; ?>
    150166                <li><?php echo $theme; ?></li>
    151167                <li><?php echo $support; ?></li>
Note: See TracChangeset for help on using the changeset viewer.