WordPress.org

Making WordPress.org


Ignore:
Timestamp:
06/22/2016 01:33:53 PM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Add plugin favoriting to the user interface.
Someone will need to style this properly.

Fixes #1577

File:
1 edited

Legend:

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

    r3466 r3545  
    1111use WordPressdotorg\Plugin_Directory\Plugin_Directory;
    1212use WordPressdotorg\Plugin_Directory\Template;
     13use WordPressdotorg\Plugin_Directory\Tools;
    1314
    1415$content = Plugin_Directory::instance()->split_post_content_into_pages( get_the_content() );
     
    3334        </div>
    3435
    35         <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
    36         <meta itemprop="softwareVersion" content="<?php echo esc_attr( get_post_meta( get_the_ID(), 'version', true ) ); ?>">
    37         <meta itemprop="fileFormat" content="application/zip">
     36        <div class="plugin-actions">
     37
     38            <?php
     39            if ( is_user_logged_in() ) {
     40                $url = Template::get_favourite_link( $post );
     41                echo '<a href="' . esc_url( $url ) . '" class="plugin-favorite-heart' . (Tools::favorited_plugin( $post ) ? ' favorited' : '' ) . '" onclick="jQuery(this).toggleClass(\'favorited\')"></a>';
     42            }
     43            ?>
     44
     45            <a class="plugin-download button download-button button-large" href="<?php echo esc_url( Template::download_link() ); ?>" itemprop="downloadUrl"><?php _e( 'Download', 'wporg-plugins' ); ?></a>
     46            <meta itemprop="softwareVersion" content="<?php echo esc_attr( get_post_meta( get_the_ID(), 'version', true ) ); ?>">
     47            <meta itemprop="fileFormat" content="application/zip">
     48        </div>
    3849
    3950        <?php the_title( '<h1 class="plugin-title">', '</h1>' ); ?>
Note: See TracChangeset for help on using the changeset viewer.