WordPress.org

Forums

[resolved] [Plugin: ShareThis] Buttons not appearing (2 posts)

  1. jesusjf
    Member
    Posted 10 months ago #

    Buttons are not showing when I use the get_content() since I have a custom script to apply 'Read more' links to individual posts.

    Only when the function defaults to the_excerpt(), do the buttons show up.

    Is there a way to make it show the buttons in this case?

    My function:

    function show_content_before_more_tag($post){
      global $more;
      $more = 0;
    
      // checks to see if the is a 'more' tag in post
      // show if theres is
      // truncate post if there is not
      $ismore = @strpos($post -> post_content, '<!--more');
      if($ismore){
        $content_arr = get_extended( get_the_content() );
        echo $content_arr['main'];
      } else {
        the_excerpt();
      }
    }
    
    // Replaces the excerpt "more" text by a link
    function new_excerpt_more($more) {
      global $post;
      return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read more.</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
  2. jesusjf
    Member
    Posted 9 months ago #

    Figured it out.

    Fixed it by changing get_the_content() to the_content()

Reply

You must log in to post.

About this Topic