Insert icons with PHP syntax

You are here:
Estimated reading time: < 1 min

IconPress has a built-in method which is used for inserting icons through PHP code editing in your theme or plugin’s code.

The easiest way of generating the PHP code, is to access My Collection and click any icon. You’ll notice the PHP tab inside:

The code explained:

if( function_exists('IconPress__getSvgIcon') ) { 
  echo IconPress__getSvgIcon( 
    array( 
      'id' => 'icon_ID', 
      'title' => __( 'Some title here', 'textdomain' ), 
      'style' => 'color:#525252; font-size:80px;', 
  ) ); 
} 

As seen in the example the function is called IconPress__getSvgIcon and you can pass an array as arguments with the icon’s options. Do know that the arguments are exactly the same as the IconPress Shortcode .

Was this article helpful?
Dislike 0
Views: 24