balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

Hooks.php (1265B)


      1 <?php
      2 namespace Welbim\Helper;
      3 
      4 /**
      5  * The admin class
      6  */
      7 class Hooks {
      8 
      9 
     10 
     11 
     12 
     13 	/**
     14 	 * Initialize the class
     15 	 */
     16 	function __construct() {
     17 		add_filter( 'wp_get_attachment_image_attributes', array( $this, 'welbim_alt_wp_get_attachment_image_attributes' ) );
     18 		add_action( 'welbim_post_share', array( $this, 'welbim_post_share' ) );
     19 	}
     20 
     21 	/**
     22 	 * Alter Image attributes from wp
     23 	 */
     24 	function welbim_alt_wp_get_attachment_image_attributes( $attr ) {
     25 		if ( isset( $attr['sizes'] ) ) {
     26 			unset( $attr['sizes'] );
     27 		}
     28 		if ( isset( $attr['srcset'] ) ) {
     29 			unset( $attr['srcset'] );
     30 		}
     31 		return $attr;
     32 	}
     33 
     34 	function welbim_post_share() {
     35 		global $post;
     36 		$post_slug = $post->post_name;
     37 		?>
     38 		<div class="blog-details__share">
     39 			<p><?php esc_html_e( 'We Are Social On:', 'welbim-core' ); ?></p>
     40 			<div class="blog-details__social">
     41 				<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>"><i class="fab fa-facebook-f"></i></a>
     42 				<a href="https://twitter.com/share?url=<?php the_permalink(); ?>&text=<?php echo $post_slug; ?>"><i class="fab fa-twitter"></i></a>
     43 				<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>"><i class="fab fa-google-plus-g"></i></a>
     44 			</div><!-- /.blog-details__social -->
     45 		</div>
     46 
     47 		<?php
     48 	}
     49 
     50 
     51 }