Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1358610

    I’m trying to get Telegram to show up in the Social Share Button on Posts and followed this support thread:

    https://kriesi.at/support/topic/add-medium-and-telegram-to-social-profiles/

    1.) downoaled the fontello Telegram font und added it via Import/Export
    2.) changed the functions.php to:

    <?php

    // Register medium and telegram icon as a theme icon
    function avia_add_custom_icon($icons) {
    $icons[‘telegram’] = array( ‘font’=>’fontello’, ‘icon’ => ‘uf2c6’);
    return $icons;
    }
    add_filter(‘avf_default_icons’,’avia_add_custom_icon’, 10, 1);

    // Add new icon as an option for social icons
    function avia_add_custom_social_icon($icons) {
    $icons[‘Telegram’] = ‘telegram’;
    return $icons;
    }
    add_filter(‘avf_social_icons_options’,’avia_add_custom_social_icon’, 10, 1);

    But I’m not seeing Telegram in my Child Themes Blog Lauout, and not as selectable Social Share Option in the Social Share Button on my Hello World Post.

    Please advice,
    Thanks

    #1358737

    Hi aboderc,

    Thanks for posting the code that you used.
    The code will only show up in Social Profiles where you have the option to add it on the header or footer, on the social links however you may need to do these extra steps:
    1. Override Social Share
    – Do the things posted on this section: https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb
    – Copy social_share folder located in the parent theme wp-content/enfold/config-templatebuilder/avia-shortcodes and paste it to the shortcodes folder in the child theme
    – Edit social_share.php in the child theme and find this code (line 453-462):

    array(
        'name'		=> __( 'YouTube Link', 'avia_framework' ),
        'desc'		=> $check_profile,
        'id'		=> 'share_youtube',
        'type'		=> 'checkbox',
        'std'		=> '',
        'container_class' => 'av_third ',
        'lockable'	=> true,
        'required'	=> array( 'buttons', 'equals', 'custom' )
    ),

    and below it add this code:

    array(
        'name'		=> __( 'Telegram Link', 'avia_framework' ),
        'desc'		=> $check_profile,
        'id'		=> 'share_telegram',
        'type'		=> 'checkbox',
        'std'		=> '',
        'container_class' => 'av_third ',
        'lockable'	=> true,
        'required'	=> array( 'buttons', 'equals', 'custom' )
    ),

    2. Add this code in functions.php:

    function avia_add_custom_social_share_link_arguments($args) {
    	$telegram = array('telegram'	=> array(
    								'encode'		=> false,
    								'encode_urls'	=> false,
    								'profile_only'	=> true
    							));
    	$args = array_merge($args, $telegram);
    	return $args;
    }
    
    add_filter('avia_social_share_link_arguments', 'avia_add_custom_social_share_link_arguments', 10, 1);

    Hope this helps.

    Best regards,
    Nikko

    #1358771

    Hi Nikko,

    thanks for help – I now can see the Telegram icon within the social share buttons BUT it is just a generell link to telegram, the behaviour is not like the facebook etc buttons – they do share the actual Post. Is there a way to also tell the telegram button to pass the URL of the Post etc directly via the social share button?

    Please note the changed URL in the private Content – I build a temp development environment …

    #1358871

    Hi aboderc,

    Please try to replace this code:

    function avia_add_custom_social_share_link_arguments($args) {
    	$telegram = array('telegram'	=> array(
    								'encode'		=> false,
    								'encode_urls'	=> false,
    								'profile_only'	=> true
    							));
    	$args = array_merge($args, $telegram);
    	return $args;
    }
    
    add_filter('avia_social_share_link_arguments', 'avia_add_custom_social_share_link_arguments', 10, 1);

    with:

    function avia_add_custom_social_share_link_arguments($args) {
    	$medal = array('medal'	=> array(
    								'encode'		=> true,
    								'encode_urls'	=> true,
    								'pattern'		=> 'https://t.me/share/url?url=[permalink]&text=[title]'
    							));
    	$args = array_merge($args, $medal);
    	return $args;
    }
    
    add_filter('avia_social_share_link_arguments', 'avia_add_custom_social_share_link_arguments', 10, 1);

    Let us know if it helps.

    Best regards,
    Nikko

    #1358877

    Hi Nico,

    perfect, just needed to replace $medal with $telegram – does now exactly what I was looking for.

    Thanks for the fast and helpful support as usual.

    And for reference the complete functions.php from my child theme that allows telegram to be used to share pages, posts etc via the social share button (after the fontello telgram icon has been imported):

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

    // Add new icon as an option for social icons
    function avia_add_custom_social_icon($icons) {
    $icons[‘Telegram’] = ‘telegram’;
    return $icons;
    }
    add_filter(‘avf_social_icons_options’,’avia_add_custom_social_icon’, 10, 1);

    // Add the URL to the telegram URL in the share section
    function avia_add_custom_social_share_link_arguments($args) {
    $telegram = array(‘telegram’ => array(
    ‘encode’ => true,
    ‘encode_urls’ => true,
    ‘pattern’ => ‘https://t.me/share/url?url=%5Bpermalink%5D&text=%5Btitle%5D&#8217;
    ));
    $args = array_merge($args, $telegram);
    return $args;
    }
    add_filter(‘avia_social_share_link_arguments’, ‘avia_add_custom_social_share_link_arguments’, 10, 1);

    #1358934

    Hi,

    Great, I’m glad that Nikko could help you out, and thanks for sharing the code you are using. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

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