Viewing 1 replies (of 1 total)
  • Plugin Author Bas Schuiling

    (@basszje)

    Hi,

    You can use it inside a plugin in multiple ways. Either use the direct functions. Within the plugin there a two, a bit like WordPress works as well:

    the_icon
    get_the_icon

    The first one is to display and output directly the icon, the second one you can use to get the icon in any case.

    get_the_icon($args, $term_type = ‘category’,$id = null, $use_term_id = null)

    $args = just the same as the_icon in the manual
    $id -> If you are outside the loop you have to pass an post or taxonomy ID there.

    For instance if you want to get an icon of a certain category it would look like

    $icon = get_the_icon(array(), null, $category_id, true );

    The $use_term_id which is set to true here is also important. If it’s set to null it’ll try to get the icon from a post id (via the terms), if it’s set to true (or whatever) it’ll use the passed ID as a term (i.e. category ) id.

    Btw if you only want the URL to be returned instead of an object you can give this in the $args;

    i.e. $args = array(“returnFull” => true);

    I hope this is a little bit clear, otherwise please ask or check the source, it’s pretty self-explanatory

Viewing 1 replies (of 1 total)
  • The topic ‘Outside the Loop’ is closed to new replies.