Use this code instead of a Plugin
-
Embed CSS with Font from Paymentfont. Then insert in your themes function:
// get list of activated payment methods: function get_payment_methods(){ $installed_payment_methods = WC()->payment_gateways->get_available_payment_gateways(); foreach($installed_payment_methods as $method){ $methods[] = array( "id" => $method->id, "title" => $method->title, "description" => $method->description, ); } return $methods; } add_action("woocommerce_init","get_payment_methods"); function payment_methods(){ if($methods = get_payment_methods()){ $html = "<ul class='payment-methods'>"; foreach($methods as $method){ // add more strings if needed, replace "another_id" $methods_id = str_replace( array("bacs","another_id"), // WooCommerce-Payment-ID array("bank-transfer","another_id"), // Payment-Font Name $method["id"] ); $html .= '<li><i class="pf pf-'.$methods_id.' payment-method"></i></li>'; } $html .= "</ul>"; return $html; } return false; } add_shortcode("payment-methods","payment_methods");
then call it everywhere in your theme with
<?php echo payment_methods(); ?>
or via shortcode:
[payment-methods]
adjust output via css to your needs!
- The topic ‘Use this code instead of a Plugin’ is closed to new replies.