Title: Adding a Pinterest button with php code?
Last modified: August 21, 2016

---

# Adding a Pinterest button with php code?

 *  Resolved [dubzzdigital](https://wordpress.org/support/users/dubzzdigital/)
 * (@dubzzdigital)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-a-pinterest-button-with-php-code-1/)
 * Hi all,
 * I have the website [Cottage Flair](http://cottageflair.co.nz/) and I am wanting
   to add a Pinterest button next to the “Newsletter” one in the purple bar of the
   homepage. I have tried editing the php functions myself but can’t for the life
   of me figure it out. If anyone could please help it would be much appreciated!
   Cheers!
 * This is what I am looking at:
 * /****************************************************************************************/
 * if ( ! function_exists( ‘attitude_home_slogan’ ) ) :
    /** * Display Home Slogan.**
   Function that enable/disable the home slogan1 and home slogan2. */ function attitude_home_slogan(){
   global $attitude_theme_options_settings; $options = $attitude_theme_options_settings;
 *  $attitude_home_slogan = ”;
    if( ( !$attitude_home_slogan = get_transient( ‘attitude_home_slogan’))&&(!
   empty( $options[ ‘home_slogan1’ ] ) || !empty( $options[ ‘home_slogan2’ ] ) )){
 *  if ( “0” == $options[ ‘disable_slogan’ ] ) {
    $attitude_home_slogan .= ‘<section
   class=”slogan-wrap clearfix”><div class=”container”><div class=”slogan”>’; if(!
   empty( $options[ ‘home_slogan1’ ] ) ) { $attitude_home_slogan .= esc_html( $options[‘
   home_slogan1’ ] ); } if ( !empty( $options[ ‘home_slogan2’ ] ) ) { $attitude_home_slogan.
   = ‘<span>’.esc_html( $options[ ‘home_slogan2′ ] ).'</span>’; } $attitude_home_slogan.
   = ‘</div><!– .slogan –>’; if ( !empty( $options[ ‘button_text’ ] ) && !empty(
   $options[ ‘redirect_button_link’ ] ) ) { $attitude_home_slogan .= ‘[‘.esc_html( $options[ ‘button_text’ ] ).’](https://wordpress.org/support/topic/adding-a-pinterest-button-with-php-code-1/&apos;.esc_url( $options[ &apos;redirect_button_link&apos; ] ).&apos;?output_format=md)
   <!– .view-work –>’; } $attitude_home_slogan .= ‘[Newsletter](http://cottageflair.us4.list-manage.com/subscribe?u=a3660c7ae24cf0dfc83d5b98b&id=03a33ac651)
   <!– .view-work –>’; $attitude_home_slogan .= ‘</div><!– .container –></section
   > <!– .slogan-wrap –>’; }
 *  set_transient( ‘attitude_home_slogan’, $attitude_home_slogan, 86940 );
    } echo
   $attitude_home_slogan; } endif;
 * /****************************************************************************************/

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-a-pinterest-button-with-php-code-1/#post-4090501)
 * Depending which side you want it on, it goes either before or after the line:
   `
   $attitude_home_slogan .= '<a class="view-work" href="http://cottageflair.us4.
   list-manage.com/subscribe?u=a3660c7ae24cf0dfc83d5b98b&id=03a33ac651">Newsletter
   </a><!-- .view-work -->';`
 * I assume you have the correct HTML for the pinterest button? It needs to be inserted
   using this format:
    `$attitude_home_slogan .='<!-- Replace this entire HTML comment
   with pinterest HTML -->';`
 * Any single quotes in the HTML need to be escaped by putting a backslash \ in 
   front of it so it is not confused with the single quotes delimiting the HTML 
   string.
 * Next time you post code in this forum, please put it between backticks so the
   forum parser doesn’t mess it up.
 *  Thread Starter [dubzzdigital](https://wordpress.org/support/users/dubzzdigital/)
 * (@dubzzdigital)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/adding-a-pinterest-button-with-php-code-1/#post-4090513)
 * Thank you! Thank you! Thank you! You are the best!
 * And sorry about the coding… will be sure to put it in correctly next time. 🙂
 * Cheers

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding a Pinterest button with php code?’ is closed to new replies.

## Tags

 * [attitude theme](https://wordpress.org/support/topic-tag/attitude-theme/)
 * [code](https://wordpress.org/support/topic-tag/code/)
 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [slogan](https://wordpress.org/support/topic-tag/slogan/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [dubzzdigital](https://wordpress.org/support/users/dubzzdigital/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/adding-a-pinterest-button-with-php-code-1/#post-4090513)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
