New Landing How can we help? Atelier How to add Social buttons to pages?

Viewing 15 posts - 1 through 15 (of 21 total)
  • Posted in: Atelier
  • #215581
    bochenn
    Member
    Post count: 18

    As the topic title reads “I want to know how to add the social share with counters” on pages. I’ve been looking around and can’t find the setting to enable that.

    Thanks,

    Attachments:
    You must be logged in to view attached files.
    #215598
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.
    add_action( 'sf_page_content_end', 'sf_post_share', 30 );
    Thanks
    Mohammad

    #215797
    bochenn
    Member
    Post count: 18

    Is there a specific place where to add that code?

    #215799
    David Martin – Support
    Moderator
    Post count: 20834

    Hi,

    “paste this code at functions.php of child theme.” Please add it inside the child theme functions.php file.

    -David.

    #215801
    bochenn
    Member
    Post count: 18

    My question is if this should in a specific line, because I did that and nothing happened, actually the main menu is gone now.

    #215856
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please remove my last code and use this new code:-

    <?php 
    if ( ! function_exists( 'sf_page_share' ) ) {
            function sf_page_share() {
                $image      = wp_get_attachment_url( get_post_thumbnail_id() );
                $share_text = apply_filters( 'sf_post_share_text', __( "Share this", "swiftframework" ) );
                ?>
                <div class="article-divider"></div>
                <div class="article-share" data-buttontext="<?php echo esc_attr($share_text); ?>"
                     data-image="<?php echo esc_url($image); ?>"></div>
            <?php
            }
        }
        add_action( 'sf_page_content_end', 'sf_page_share', 30 );
    ?>

    Thanks
    Mohammad

    #215865
    bochenn
    Member
    Post count: 18

    When I do that I get a white screen and no error messages or anything.
    Also attached I send you an image of some glyphs in red that I see when I add the code.

    This is how the code for the functions.php looks now:

    <?php
    	
    	/*
    	*
    	*	Atelier Functions - Child Theme
    	*	------------------------------------------------
    	*	These functions will override the parent theme
    	*	functions. We have provided some examples below.
    	*
    	*
    	*/
    	
    	/* LOAD PARENT THEME STYLES
    	================================================== */
    	function atelier_child_enqueue_styles() {
    	    wp_enqueue_style( 'atelier-parent-style', get_template_directory_uri() . '/style.css' );
    	
    	}
    	add_action( 'wp_enqueue_scripts', 'atelier_child_enqueue_styles' );
    	
    	
    	/* LOAD THEME LANGUAGE
    	================================================== */
    	/*
    	*	You can uncomment the line below to include your own translations
    	*	into your child theme, simply create a "language" folder and add your po/mo files
    	*/
    	
    	// load_theme_textdomain('swiftframework', get_stylesheet_directory().'/language');
    	
    	
    	/* REMOVE PAGE BUILDER ASSETS
    	================================================== */
    	/*
    	*	You can uncomment the line below to remove selected assets from the page builder
    	*/
    	
    	// function spb_remove_assets( $pb_assets ) {
    	//     unset($pb_assets['parallax']);
    	//     return $pb_assets;
    	// }
    	// add_filter( 'spb_assets_filter', 'spb_remove_assets' );	
    
    	/* ADD/EDIT PAGE BUILDER TEMPLATES
    	================================================== */
    	function custom_prebuilt_templates($prebuilt_templates) {
    			
    		/*
    		*	You can uncomment the lines below to add custom templates
    		*/
    		// $prebuilt_templates["custom"] = array(
    		// 	'id' => "custom",
    		// 	'name' => 'Custom',
    		// 	'code' => 'your-code-here'
    		// );
    
    		/*
    		*	You can uncomment the lines below to remove default templates
    		*/
    		// unset($prebuilt_templates['home-1']);
    		// unset($prebuilt_templates['home-2']);
    
    		// return templates array
    	    return $prebuilt_templates;
    
    	}
    	//add_filter( 'spb_prebuilt_templates', 'custom_prebuilt_templates' );
    	
    //	function custom_post_thumb_image($thumb_img_url) {
    //	    
    //	    if ($thumb_img_url == "") {
    //	    	global $post;
    //	  		ob_start();
    //	  		ob_end_clean();
    //	  		$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    //	  		if (!empty($matches) && isset($matches[1][0])) {
    //	  		$thumb_img_url = $matches[1][0];
    //	    	}
    //	    }
    //	    
    //	    return $thumb_img_url;
    //	}
    //	add_filter( 'sf_post_thumb_image_url', 'custom_post_thumb_image' );
    	
    //	function dynamic_section( $sections ) {
    //        //$sections = array();
    //        $sections[] = array(
    //            'title'  => __( 'Section via hook', 'redux-framework-demo' ),
    //            'desc'   => __( '<p class="description">This is a section created by adding a filter to the sections array. Can be used by child themes to add/remove sections from the options.</p>', 'redux-framework-demo' ),
    //            'icon'   => 'el-icon-paper-clip',
    //            // Leave this as a blank section, no options just some intro text set above.
    //            'fields' => array()
    //        );
    //        return $sections;
    //    }
    //	
    	
    //	function custom_style_sheet() {
    //	    echo '<link rel="stylesheet" href="'.get_stylesheet_directory_uri() . '/test.css'.'" type="text/css" media="all" />';
    //	}
    //	add_action('wp_head', 'custom_style_sheet', 100);
    	
    
    	// function custom_wishlist_icon() {
    	// 	return '<i class="fa-heart"></i>';
    	// }
    	// add_filter('sf_wishlist_icon', 'custom_wishlist_icon', 100);
    	// add_filter('sf_add_to_wishlist_icon', 'custom_wishlist_icon', 100);
    	// add_filter('sf_wishlist_menu_icon', 'custom_wishlist_icon', 100);
    <?php
    if ( ! function_exists( 'sf_page_share' ) ) {
    function sf_page_share() {
    $image = wp_get_attachment_url( get_post_thumbnail_id() );
    $share_text = apply_filters( 'sf_post_share_text', __( "Share this", "swiftframework" ) );
    ?>
    <div class="article-divider"></div>
    <div class="article-share" data-buttontext="<?php echo esc_attr($share_text); ?>"
    data-image="<?php echo esc_url($image); ?>"></div>
    <?php
    }
    }
    add_action( 'sf_page_content_end', 'sf_page_share', 30 );
    ?>
    Attachments:
    You must be logged in to view attached files.
    #215868
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    That line 110 in my screenshot doesn’t make sense, since php is still open from the line 1.
    https://www.dropbox.com/s/nmra8qifwdwa7kj/Screenshot%202015-09-23%2017.30.56.png?dl=0

    Comment that line and give it a try.

    -Rui

    #215869
    bochenn
    Member
    Post count: 18

    Also line 120?

    #215871
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    No, just the 110 in my screenshot
    <?php

    -Rui

    #215872
    bochenn
    Member
    Post count: 18

    Thanks Rui, now I just see a gray short line but no share links. Also in the source code I see an empty DIV as you can see in the attachment.

    Attachments:
    You must be logged in to view attached files.
    #215875
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Can you provide me ftp access so I can debug the values in the code Mohammad provided?
    Use the private reply.

    -Rui

    #215879
    bochenn
    Member
    Post count: 18
    This reply has been marked as private.
    #215975
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I fixed the code so please check it now.
    Thanks
    Mohammad

    #216597
    bochenn
    Member
    Post count: 18

    Hey guys, this is not working. I don’t know what you did but it didn’t work.

Viewing 15 posts - 1 through 15 (of 21 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register