Digital experiences for all disciplines
New Landing › How can we help? › Atelier › How to add Social buttons to pages?
New Landing › How can we help? › Atelier › How to add Social buttons to pages?
- This topic has 20 replies, 4 voices, and was last updated 9 years by Mohammad – SUPPORT.
-
Posted in: Atelier
-
September 23, 2015 at 5:12 am #215581
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.September 23, 2015 at 7:44 am #215598Hi,
Please paste this code at functions.php of child theme.
add_action( 'sf_page_content_end', 'sf_post_share', 30 );
Thanks
MohammadSeptember 23, 2015 at 3:17 pm #215797Is there a specific place where to add that code?
September 23, 2015 at 3:21 pm #215799Hi,
“paste this code at
functions.php
of child theme.” Please add it inside the child themefunctions.php
file.-David.
September 23, 2015 at 3:23 pm #215801My question is if this should in a specific line, because I did that and nothing happened, actually the main menu is gone now.
September 23, 2015 at 5:15 pm #215856Hi,
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
MohammadSeptember 23, 2015 at 5:26 pm #215865When 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.September 23, 2015 at 5:30 pm #215868That 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=0Comment that line and give it a try.
-Rui
September 23, 2015 at 5:31 pm #215869Also line 120?
September 23, 2015 at 5:33 pm #215871No, just the 110 in my screenshot
<?php
-Rui
September 23, 2015 at 5:36 pm #215872Thanks 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.September 23, 2015 at 5:40 pm #215875Can you provide me ftp access so I can debug the values in the code Mohammad provided?
Use the private reply.-Rui
September 23, 2015 at 5:44 pm #215879This reply has been marked as private.September 24, 2015 at 7:37 am #215975Hi,
I fixed the code so please check it now.
Thanks
MohammadSeptember 25, 2015 at 11:32 pm #216597Hey guys, this is not working. I don’t know what you did but it didn’t work.
-
Posted in: Atelier
You must be logged in and have valid license to reply to this topic.