• I’m developing a theme and having trouble with getting the share functionality to show up on author biography pages. The attached link shows just one person, but it’s like this on all author pages.

    In my author.php page, I have a widget callout structured like this:

    <div class="widget widget_social_share">
      <h4>Share</h4>
      <div class="side-content">
        <?php echo do_shortcode('[Sassy_Social_Share]'); ?>
      </div>
    </div>
    

    For some reason, the shortcode does not work here. It does work on other pages, such as any single post page in both the sidebar and the bottom of the post. Both of these locations use a similar code containing the do_shortcode function.

    The usage here is to share the author pages only. I do not want to share all archive related pages.

    Any help would be appreciated.

    Thanks

    UPDATE: The links DO show up when a post has been attributed to the author. Is there any way around this?

    • This topic was modified 4 years, 11 months ago by Buchanan Webmaster. Reason: Noted in context

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Heateor Support

    (@heateor)

    There is following line of code in “wp-content/plugins/sassy-social-share/includes/class-sassy-social-share-shortcodes.php” which, probably, is the logic that is preventing the share icons from being rendered.

    if ( ! is_object( $post ) ) {
        return;
    }

    If the webpage you have mentioned here isn’t a valid WordPress post (according to the code above), share icons won’t be rendered. You can try commenting out this code just to confirm the same.

    Thread Starter Buchanan Webmaster

    (@jeffsydor-bipc)

    I tried commenting it out and received this error:

    Notice: Trying to get property ‘ID’ of non-object in /…/wp-content/plugins/sassy-social-share/includes/class-sassy-social-share-shortcodes.php on line 153

    This code is the elseif:

    elseif ( get_permalink( $post -> ID ) ) {
    $target_url = get_permalink( $post -> ID );
    $post_id = $post -> ID;}
    
    Plugin Author Heateor Support

    (@heateor)

    It means $post is not an object and that’s why share icons are not appearing. Plugin displays share icons only at the webpages which are valid PHP objects. You can’t do anything about it. Plugin is supposed to work like this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘shortcode not displaying’ is closed to new replies.