• Resolved awpt

    (@awpt)


    Hi, thanks for the plugin.

    is there any trick to use our own button code instead?

    for example

    <li class="fav"><a href="#"><i class="fa fa-heart ico_heart" aria-hidden="true"></i></a></li>

    it would be great if you have time to guide us here thankyou again.

    • This topic was modified 8 years, 6 months ago by awpt.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter awpt

    (@awpt)

    I was checking your documentation on your site

    for example

    add_filter( 'favorites/button/html', 'custom_favorites_button_html', 10, 4 );
    function custom_favorites_button_html($html, $post_id, $favorited, $site_id) {
    	$html = 'test';
    	return $html;
    }

    this one is changing only the button text but still using the <button> So it doesnt change the html but only the button text.

    Also is it possible to disable the auto display under the post content from theme functions?

    • This reply was modified 8 years, 6 months ago by awpt.
    • This reply was modified 8 years, 6 months ago by awpt.
    Thread Starter awpt

    (@awpt)

    Since the button looks different on the different browsers I resolved using jquery:

    function:

    //Custom favorite button requires favoriteposts plugin
    if (function_exists('get_favorites_button')) {
    add_filter( 'favorites/button/html', 'custom_favorites_button_html', 10, 4 );
    }
    function custom_favorites_button_html($html, $post_id, $favorited, $site_id) {
    	$html = '<i class="fa fa-heart ico_heart" aria-hidden="true"></i>';
    	return $html;
    }

    jQuery:

    jQuery(function() {
    jQuery('button').each(function(){
      var clone = document.createElement('li');
      for(var i = 0, len = this.attributes.length; i < len; i++) {
        clone.setAttribute(this.attributes[i]['name'], this.attributes[i]['value']);
      }
      jQuery(this).contents().unwrap().wrap(clone);
    })
    });

    If you can make it easier would be great but for now I have resolved using the jquery.

    • This reply was modified 8 years, 6 months ago by awpt.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to use our own button code?’ is closed to new replies.