I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

coin ticker hide

dashed-slug.net Forums Faucet extension support coin ticker hide

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #9790
    LeinAd
    Participant

    i really have to say that your work has a lot of potential. now i wanted to set up a “votin page” and hide the coin ticker. it’s the “balance-static.php template”, right? i would duplicate it and change the code. however, i’m not sure about the ticker what all needs to be removed

    sincerly – LeinAd

    Attachments:
    You must be logged in to view attached files.
    #9805
    alexg
    Keymaster

    Hello,

    The balance-static.php template corresponds to the shortcode [wallets_balance template="static"]. This is for rendering the balance UI on the server side. You get no live updates to the values, but you can pass the user_id or symbol attributes. All of this mess will be resolved in wallets6.

    The best way to control the symbol next to amounts is not to override the templates, but to use the special filter for this purpose.

    From the documentation to the JSON-API.

    Amounts pattern

    Cryptocurrency amounts in the frontend are passed through an sprintf() function. The JavaScript implementation used is https://github.com/alexei/sprintf.js.

    wallets_sprintf_pattern_XYZ – Display pattern for amounts of coin with symbol XYZ.

    To override the frontend display format for Bitcoin amounts:

            public function filter_wallets_sprintf_pattern_BTC( $pattern ) {
                    return 'BTC %01.8f';
            }
    
            add_filter( 'wallets_sprintf_pattern_BTC', 'filter_wallets_sprintf_pattern_BTC' );

    So you can use this filter in your theme or child theme to modify the pattern that amounts are shown for any currency. (Note that this filter has been re-implemented in the upcoming REST API in wallets6, so you can expect it to continue to work into the future.)

    Hope this helps. Let me know if you encounter any diffculty implementing this solution.

    with regards

    #9806
    LeinAd
    Participant

    i become a critical error with

            public function filter_wallets_sprintf_pattern_BTC( $pattern ) {
                    return 'BTC %01.8f';
            }
    
            add_filter( 'wallets_sprintf_pattern_BTC', 'filter_wallets_sprintf_pattern_BTC' );

    i will try it later

    #9807
    alexg
    Keymaster

    Sorry, I copied the code from inside a class and forgot there was a visibility modifier in there 🙂

    Try again without the public keyword.

    with regards

    #9809
    LeinAd
    Participant

    it’s kinda not my day. when i paste this in the copy of balance-static i get “Fatal error: Cannot redeclare” and when i use it in functions php nothing happens at all 🙁

    #9810
    LeinAd
    Participant

    so ok i tried it again but i have the coin symbol still there. But i have to hide this, outherwise my meter bar wont work :o(

    Attachments:
    You must be logged in to view attached files.
    #9817
    alexg
    Keymaster

    Oh OK I see now.

    The filter modifies the JSON-API responses. The JSON-API data is used by the dynamic UIs.

    If you are going to use template=”static”, then yes, the best way to do this is to modify the template.

    Instead of

    
    if ( isset( $adapters[ $atts['symbol'] ] ) ) {
            $balance_str = sprintf( $adapters[ $atts['symbol'] ]->get_sprintf(), $balance );
    } else {
            $balance_str = sprintf( "$atts[symbol] %01.8f", $balance );
    }
    

    You could have something like:

    $balance_str = sprintf( "%01.8f", $balance );

    You should place your modified copy of the template under your theme directory, at /templates/wallets/balance-static.php, as described here.

    Hope this helps, and apologies for the confusion.

    #9822
    LeinAd
    Participant

    very great. now it is working. thank you

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.