• Resolved Luís Santos

    (@elsantos)


    Hi,
    I use Enfold theme and I have some code in functions.php to use a custom print icon in a specific place.
    I would like to link that icon to Print Friendly, is that possible?

    Thank you

    This is the code:

    // Register PrintFriendly icon as a theme icon
    function avia_add_custom_icon($icons) {
    $icons[‘PrintFriendly’] = array( ‘font’ =>’entypo-fontello’, ‘icon’ => ‘ue838’);
    return $icons;
    }
    add_filter(‘avf_default_icons’,’avia_add_custom_icon’, 10, 1);

    //Add items on the social share section
    add_filter(‘avia_social_share_link_arguments’, ‘avia_add_social_share_link_arguments’, 10, 1);
    function avia_add_social_share_link_arguments($args) {
    $new_array = array(
    ‘PrintFriendly’ => array(
    “encode”=>true, “encode_urls”=>false, “pattern” => “https://”
    )
    );

    return array_merge($new_array, $args);
    }

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor contactashish13

    (@rozroz)

    @elsantos if you want to use a custom icon, you can use the custom image feature and upload/select the image that you wish to use. This will merely replace the default printfriendly image with the custom image.

    Alternatively, if you want to do this dynamically through code you can use the below filter:

    
    add_filter( 'printfriendly_button', function($html){
    // change the img tag inside the $html using regex
    return $html;
    }, 10, 1);
    

    I’m not sure what you mean by “in a specific place” – do you want this in the template (on every page that uses the template) or in a specific page? Can you please share an annotated screenshot so that this becomes clearer?

    Thread Starter Luís Santos

    (@elsantos)

    @rozroz Enfold works with elements.

    There’s an element called “Social Share Buttons” on every pages.

    In order to add a print icon on that element i had to put a code on functions.php file, the code that i have added on previous message (Please see attachment)

    The icons appears on that element, but i don’t know how to link it to Print Friendly.

    Not easy to explain, but thank you!

    https://imageupload.io/i/Jryis74O7f

    Plugin Contributor contactashish13

    (@rozroz)

    @elsantos thanks for the explanation!

    Have you configured PrintFriendly to show up on every page/post or have you configured it to show up through a shortcode? It would be great if you could share a screenshot for that configuration so that we can guide you accordingly.

    Plugin Author Print & PDF by PrintFriendly

    (@printfriendly)

    @elsantos You can share to printfriendly using the following URL pattern

    https://www.printfriendly.com/print?url=POST_URL

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add PF link to code’ is closed to new replies.