Refactor social sharing buttons and add Twitter SVG icon

This commit is contained in:
Keith Solomon
2026-08-12 18:14:36 -05:00
parent b7dfda1f99
commit 9249a1e0a1
3 changed files with 31 additions and 16 deletions
+15
View File
@@ -0,0 +1,15 @@
<!-- @license lucide-static v0.460.0 - ISC -->
<svg
class="lucide lucide-twitter"
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z" />
</svg>

After

Width:  |  Height:  |  Size: 438 B

+2 -8
View File
@@ -271,12 +271,6 @@ function projects_portfolio_enqueue_project_styles() {
wp_enqueue_style( 'projects-wp-styles' );
}
}
if ( is_singular( 'projects' ) ) {
// assets/js/buttons.js was used to render GitHub-style follow buttons.
// The Follow button now uses a plain styled link (works for any provider),
// so the script is no longer enqueued.
}
}
add_action( 'wp_enqueue_scripts', 'projects_portfolio_enqueue_project_styles' );
@@ -350,11 +344,11 @@ function projects_portfolio_social_sharing_buttons( $project_id ) {
$html = '<div class="project-social-sharing">';
$svg_icon = function( string $name, string $file ) use ( &$html ) {
$svg_icon = function ( string $name, string $file ) use ( &$html ) {
// Render each social icon as an <img> referencing a real .svg file
// shipped under assets/icons/. This bypasses any kses data: URI stripping
// and ensures the icon loads as a normal image via standard img rules.
$src = plugins_url( 'assets/icons/' . $file, __FILE__ );
$src = plugins_url( 'assets/icons/' . $file, __FILE__ );
$html .= '<img src="' . esc_url( $src ) . '" alt="' . esc_attr( $name ) . '" width="20" height="20" style="width:20px;height:20px;display:inline-block;vertical-align:middle;" />';
};
+14 -8
View File
@@ -116,24 +116,30 @@ if ( $last_updated ) {
<?php endif; ?>
<?php
if ( ! empty( $repo_data ) ) :
if ( isset( $repo_data['stargazers_count'] ) && $settings['templates']['stargazers_count'] ) : ?>
if ( isset( $repo_data['stargazers_count'] ) && $settings['templates']['stargazers_count'] ) :
?>
<tr>
<th><?php esc_html_e( 'Stars:', 'projects-wp' ); ?></th>
<td><?php esc_html_e( $repo_data['stargazers_count'] ); ?></td>
</tr>
<?php endif;
if ( isset( $repo_data['forks_count'] ) && $settings['templates']['forks'] ) : ?>
<?php
endif;
if ( isset( $repo_data['forks_count'] ) && $settings['templates']['forks'] ) :
?>
<tr>
<th><?php esc_html_e( 'Forks:', 'projects-wp' ); ?></th>
<td><?php esc_html_e( $repo_data['forks_count'] ); ?></td>
</tr>
<?php endif;
if ( isset( $repo_data['open_issues_count'] ) && $settings['templates']['open_issues_count'] ) : ?>
<?php
endif;
if ( isset( $repo_data['open_issues_count'] ) && $settings['templates']['open_issues_count'] ) :
?>
<tr>
<th><?php esc_html_e( 'Issues:', 'projects-wp' ); ?></th>
<td><?php esc_html_e( $repo_data['open_issues_count'] ); ?></td>
</tr>
<?php endif;
<?php
endif;
endif;
?>
</tbody>
@@ -142,7 +148,7 @@ if ( $last_updated ) {
<?php if ( $settings['templates']['github_owner'] && $owner_avatar && $owner_name ) : ?>
<div class="project-owner">
<span class="project-owner-avatar" style="display:block !important;width:40px !important;height:40px !important;min-width:40px !important;min-height:40px !important;max-width:40px !important;max-height:40px !important;border-radius:50% !important;background-image:url('<?php echo esc_url( $owner_avatar ); ?>') !important;background-size:40px 40px !important;background-position:center center !important;background-repeat:no-repeat !important;flex-shrink:0 !important;flex-grow:0 !important;" aria-label="<?php echo esc_attr( $owner_name ); ?>" role="img"></span>
<span class="project-owner-avatar" style="display:block !important;width:50px !important;height:50px !important;min-width:50px !important;min-height:50px !important;max-width:50px !important;max-height:50px !important;border-radius:50% !important;background-image:url('<?php echo esc_url( $owner_avatar ); ?>') !important;background-size:40px 40px !important;background-position:center center !important;background-repeat:no-repeat !important;flex-shrink:0 !important;flex-grow:0 !important;" aria-label="<?php echo esc_attr( $owner_name ); ?>" role="img"></span>
<span class="project-owner-name">
<a href="<?php echo esc_url( $owner_url ); ?>" target="_blank" rel="noopener noreferrer"><?php echo esc_html( $owner_name ); ?></a>
</span>
@@ -161,7 +167,7 @@ if ( $last_updated ) {
<?php
if ( $is_fse_theme ) {
wp_footer();
echo do_blocks( '<!-- wp:template-part {"slug":"footer"} /-->' );
echo do_blocks( '<!-- wp:template-part {"slug":"footer"} /-->' ); // phpcs:ignore
} else {
get_footer();
}