Share bar in pages
-
Hi.
I would like to add the sharing buttons (share bar) in pages. When I activate them I see the bar in posts but my site is based on pages.
any ideas?
kind regards. P.BARBAROUX
-
Hi barbaroux. This topic should help:
https://wordpress.org/support/topic/social-sharing-must-also-available-in-a-page-not-just-a-post/Hi bdbrown
I have made modifications on page.php as seen on the topic but it does not work.
share buttons continue to appear in posts and not in pages.
kind regards,
P.BARBAROUXCan you post a link to your site? thanks.
OK, my mistake. Since the shortcodes and sharebar were moved to a plugin the code architecture discussed in that topic is no longer used. There is currently no easy way to do this other than modifying the page.php file (differently) and copying and modifying the Hueman Addons plugin. The thing you’ll need to remember is when you update the theme you need to check to see if page.php has changed. If it has you’ll need to copy the new page.php file to your child theme and reapply your modifications. If you update the Hueman Addons plugin there could be changes in any part of it. The best approach for this would be to copy all the files and subfolders from the updated Hueman plugin to a custom plugin folder, then reapply the modifications described below.
Having said all that, here are the steps:
1. Using your host file manager or FTP, copy the /wp-content/plugins/hueman-addons folder to a new folder.
2. Rename the new folder to something unique like hueman-addons-custom.
3. In the custom plugin folder, open the heuman-addons.php file.
4. At the top of the file change:
a. the Plugin Name: Hueman Addons Custom
b. the Description: Hueman Theme Addons Customized by P.BARBAROUX5. Scroll about half way down the file to find this section:
/************************************************************** ** SHARRRE **************************************************************/ function hu_sharrre_front_actions() { if ( ! is_single() ) return;6. Change it to this:
/************************************************************** ** SHARRRE **************************************************************/ function hu_sharrre_front_actions() { //if ( ! is_single() ) // return; // load sharebar on posts and pages but not home page if ( is_single() || ( is_page() && (! is_home()) ) ) {7. At the bottom of that function add another closing bracket:
/************************************************************** ** SHARRRE **************************************************************/ function hu_sharrre_front_actions() { //if ( ! is_single() ) // return; // load sharebar on posts and pages but not home page if ( is_single() || ( is_page() && (! is_home()) ) ) { //alter the single entry wrapper class add_filter( 'hu_single_entry_class', array($this, 'hu_maybe_add_sharrre_class')); //hook the sharrre content to the single post template add_action( 'hu_after_single_entry_inner', array($this, 'hu_maybe_print_sharrre_template') ); } } <==============8. In your child theme delete the current modified page.php and copy in a new one from the parent theme.
9. In the middle of page.php you’ll see this:
<div class="entry themeform"> <?php the_content(); ?> <div class="clear"></div> </div><!--/.entry-->10. Change it to this:
<!-- change the container class so it will include the sharebar --> <!-- <div class="entry themeform"> --> <div class="<?php echo implode( ' ', apply_filters( 'hu_single_entry_class', array('entry','themeform') ) ) ?>"> <?php the_content(); ?> <!-- add call to load sharebar --> <?php do_action( 'hu_after_single_entry_inner' ); ?> <div class="clear"></div> </div><!--/.entry-->11. Go to your admin Installed Plugins.
12. Deactivate Hueman Addons and activate Hueman Addons Custom.
That should do it. Let me know if you have any questions.
Hi bdbrown
it works!
many thanks for the way you explained it with details, for your availability and your professional service.
kind regards,
P.BARBAROUXYou’re welcome; glad to help.
The topic ‘Share bar in pages’ is closed to new replies.
