• Resolved tinley

    (@tinley)


    I bought Author Pro, it’s a great theme. I need to add a social button for Goodreads e.g. https://www.goodreads.com/tinley, alongside the existing buttons for Facebook, Twitter etc. It would seem to make sense as it’s an author theme. How do I do that please?

    I’ve searched the forum and it seems when people have asked for other social sites not on the list you’ve set them up. I’d happily do it with a few pointers but maybe that’s not possible? I can easily make an icon but not 100% sure where they’re stored – in a fonts file? or how best to tweak the code.

    Site not live yet, only have a local copy, hence no link. Any pointers gratefully appreciated.

    • This topic was modified 6 years, 3 months ago by tinley.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Thanks so much for upgrading!

    The icon font used in Author unfortunately doesn’t have an icon for Goodreads yet. However, if you can create or get access to an icon for your site then I can certainly help out with the customization.

    You’ll want to copy the “ct_author_social_icons_output()” function in functions.php into your child theme’s functions.php file to override it. Then you can simply hardcode the Goodreads icon in. This is easier than adding it to the Customizer and should work fine for one site.

    Here’s an example of how I would include icon after the other icons:

    function ct_author_social_icons_output() {
    
    		$social_sites = ct_author_social_array();
    		$square_icons = array(
    			'linkedin',
    			'twitter',
    			'vimeo',
    			'youtube',
    			'pinterest',
    			'rss',
    			'reddit',
    			'tumblr',
    			'steam',
    			'xing',
    			'github',
    			'google-plus',
    			'behance',
    			'facebook'
    		);
    
    		foreach ( $social_sites as $social_site => $profile ) {
    
    			if ( strlen( get_theme_mod( $social_site ) ) > 0 ) {
    				$active_sites[ $social_site ] = $social_site;
    			}
    		}
    
    		if ( ! empty( $active_sites ) ) {
    
    			echo "<div class='social-media-icons'><ul>";
    
    				foreach ( $active_sites as $key => $active_site ) {
    
    					// get the square or plain class
    					if ( in_array( $active_site, $square_icons ) ) {
    						$class = 'fa fa-' . $active_site . '-square';
    					} else {
    						$class = 'fa fa-' . $active_site;
    					}
    					if ( $active_site == 'email-form' ) {
    						$class = 'fa fa-envelope-o';
    					}
    
    					if ( $active_site == 'email' ) { ?>
    						<li>
    							<a class="email" target="_blank"
    							   href="mailto:<?php echo antispambot( is_email( get_theme_mod( $active_site ) ) ); ?>">
    								<i class="fa fa-envelope" title="<?php echo esc_attr_x( 'email', 'noun', 'author' ); ?>"></i>
    								<span class="screen-reader-text"><?php echo esc_html_x('email', 'noun', 'author'); ?></span>
    							</a>
    						</li>
    					<?php } elseif ( $active_site == 'skype' ) { ?>
    						<li>
    							<a class="<?php echo esc_attr( $active_site ); ?>" target="_blank"
    							   href="<?php echo esc_url( get_theme_mod( $active_site ), array( 'http', 'https', 'skype' ) ); ?>">
    								<i class="<?php echo esc_attr( $class ); ?>"
    								   title="<?php echo esc_attr( $active_site ); ?>"></i>
    								<span class="screen-reader-text"><?php echo esc_html( $active_site );  ?></span>
    							</a>
    						</li>
    					<?php } else { ?>
    						<li>
    							<a class="<?php echo esc_attr( $active_site ); ?>" target="_blank"
    							   href="<?php echo esc_url( get_theme_mod( $active_site ) ); ?>">
    								<i class="<?php echo esc_attr( $class ); ?>"
    								   title="<?php echo esc_attr( $active_site ); ?>"></i>
    								<span class="screen-reader-text"><?php echo esc_html( $active_site );  ?></span>
    							</a>
    						</li>
    						<?php
    					}
    				} ?>
    				<li>
    					<a class="goodreads" target="_blank"
    							href="http://goodreads.com/profile">
    							<img src="http://website.com/image.png" />
    						<span class="screen-reader-text">Goodreads</span>
    					</a>
    				</li><?php
    			echo "</ul></div>";
    		}
    	}

    Edit: Oof sorry about the formatting! The relevant piece is at the bottom.

    • This reply was modified 6 years, 3 months ago by Ben Sibley.

    Hi Ben,

    This subject has fascinated me: so much so, that I began digging, because I also need another Icon not supported, but mine is for (feedbooks) and I’m not asking for it to be included as I’ve used the QQ Penguin Icon, or whatever that Chinese thing is.

    Anyway, going through your Icon library from Font Awesome, – I’ve found a book one called fp-book that looked quite good. Altered my (fat Chinese penguin) using the browser Inspector, and it really does fit the bill.

    That Icon could be a good generic editing Icon for us awkward blighters.

    Book writer contact links for example are feedbooks and goodreads and wattpad to name just three, more book sites here, and I have accounts on a couple of them.

    Tried to include the Book Icon on my site, and crashed it, – (Badly!) – But I was still logged in with FileZilla, so I just changed the customiser.php file back to the old one.

    But from that, I realised that’s it’s not going to be *that* easy.

    Now, I’m not asking you to implement that Book Icon, but perhaps you could just keep the idea on the back burner, for perhaps a future feature?

    Cheers from Jessica.

    Theme Author Ben Sibley

    (@bensibley)

    Thanks for the feedback Jessica. I may have to implement a new icon font since that is the bottleneck here. It’s just tough to find one that has support for all of the social sites out there.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add social button for Goodreads’ is closed to new replies.