Advertisement
designbymerovingi

Replace myCRED link with button

Jul 28th, 2017
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. /**
  2.  * Change Links to Buttons
  3.  * @since 1.0
  4.  * @version 1.0
  5.  */
  6. function mycred_pro_turn_link_into_button( $html, $atts ) {
  7.  
  8.     // Swap opening tag
  9.     $html = str_replace( '<a', '<button', $html );
  10.  
  11.     // Swap closing tag
  12.     $html = str_replace( '</a>', '</button>', $html );
  13.  
  14.     // Remove href="..."
  15.     $href = 'href="' . $atts['href'] . '"';
  16.     $html = str_replace( $href, '', $html );
  17.  
  18.     return $html;
  19.  
  20. }
  21. add_filter( 'mycred_link', 'mycred_pro_turn_link_into_button' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement