• Resolved zhart

    (@zhart)


    Hello and thank you for you work.
    I use “Advanced Custom Fields” plugun for creating custom fields in my content. Unfortunately, when I try to use “Sassy Social Share” with “Bottom of the content” option activated (in the “Position with respect to content” section), social buttons display before custom fields. That is buttons display in the middle of content (immediately after <?php the_content(); ?> part, but before custom fields). However, other plugins are processed after the custom files. Can you help me please fix this issue?

    • This topic was modified 7 years, 3 months ago by zhart.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Heateor Support

    (@heateor)

    Hi,

    You can try replacing the number 99 in following lines of code in wp-content/plugins/sassy-social-share/includes/class-sassy-social-share.php file:
    add_filter( 'the_content', array( $plugin_public, 'render_sharing' ), 99 );
    add_filter( 'the_excerpt', array( $plugin_public, 'render_sharing' ), 99 );
    add_action( 'bp_activity_entry_meta', array( $plugin_public, 'render_sharing' ), 999 );
    with a higher number (like 200) to force the share icons at the bottom of the content. This number is the priority to place the share icons below the content. Higher the number, less priority will be given to share icons and other things can find their place in the content before our icons.
    We will provide an option for this in upcoming release so that it can be set from plugin options page in admin area.

    Thread Starter zhart

    (@zhart)

    Unfortunately it doesn’t help.
    I think it’s happen because in any case social buttons display immediately after <?php the_content(); ?> part, but custom fields doesn’t.
    Code in my theme has this structure:

    <section class="main-content">
    <!-- Part "the_content" is displayed here -->
    <!-- Social buttons are displayed here -->
    </section>
    <section class="custom-fields">
    <!-- Custom fields are displayed here -->
    </section>

    So as you can see social buttons are displayed even in the same section with main content, but my custom fields displayed in the section below. I need to display social buttons after all my content, but before comments sections.
    Can I specify the place in the theme code in which the buttons should be displayed?
    At once I will say that shortcodes do not suit me because I use the theme on several sites at once and I need social buttons to be displayed only on some sites.

    For example, for “Contextual Related Posts” plugin I just add to theme string <?php if ( function_exists( 'echo_ald_crp' ) ) echo_ald_crp(); ?> for displaying related posts blocks, and if plugin is not active then this code display nothing. Is it possible something like this for your plugin?

    Thread Starter zhart

    (@zhart)

    Well, temporary solution for me is adding custom widget area immediately after post body and placing buttons by the use of widget. Please tell me, if you have some better solution.

    Plugin Author Heateor Support

    (@heateor)

    You can use the shortcode for social sharing at the desired place by using following code:
    <?php echo do_shortcode( '[Sassy_Social_Share]' ); ?>

    Thread Starter zhart

    (@zhart)

    I can’t use shortcode because as I said before I use same theme (by symlinks) in several sites, and in some of them I do not use social buttons. So in such sites in place of buttons is displaying [Sassy_Social_Share] text when I use shortcode. And as I said before as example, with “Contextual Related Posts” plugin in this case it’s disblay nothing (it’s desirable behaviour).

    In any case, I’m satisfied with the use of widgets, so issue is resolved.

    Plugin Author Heateor Support

    (@heateor)

    Okay. No worries.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display buttons after custom fields’ is closed to new replies.