Jump to content


Photo
- - - - -

Hooks Help: Adding Social Button Before Content


  • Please log in to reply
4 replies to this topic

#1 tuanma

tuanma

    Advanced Member

  • Members
  • 83 posts

Posted 27 March 2012 - 03:45 PM

Hello,

Wanted to see if there was anyone who could assist me in getting my hook to work the way I want. I have a hook that adds a social button before content, however, I only want it to appear in posts. Currently, it's appearing in posts and pages. I have the following which needs an "if"....

Please Login or Register to see this Hidden Content

Thanks in advance.

#2 arpowers

arpowers

    Founder

  • Administrators
  • 3271 posts
  • LocationSan Francisco, CA
  • Framework Version:2.3
  • Country: Country Flag

Posted 27 March 2012 - 10:35 PM

sure,

just wrap a

Please Login or Register to see this Hidden Content

around it :)

#3 tuanma

tuanma

    Advanced Member

  • Members
  • 83 posts

Posted 28 March 2012 - 06:21 AM

Tried the following and site crashed. I think I have some of the coding wrong....a newbie here. add_action('pagelines_loop_before_post_content', 'add_social_btn'); function add_social_btn(){ ?> if(is_single()){ ( ) }

#4 Jenny

Jenny

    Advocate

  • Unicorn Store Dev

  • 2924 posts
  • LocationWV
  • Country: Country Flag

Posted 28 March 2012 - 06:29 PM

You're closing out your php before the if(is_single()) call, which is not good. This code should work for you (although we cannot verify your iframe code to know if it's right):

Please Login or Register to see this Hidden Content



#5 tuanma

tuanma

    Advanced Member

  • Members
  • 83 posts

Posted 29 March 2012 - 05:41 AM

Thanks for your help. Worked like a charm.