Refactor social sharing buttons and add Twitter SVG icon
This commit is contained in:
@@ -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;" />';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user