Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

[Genesis] how to put a "tweet" button under each post in list WordPress

  • SOLVED

Howdy again WP gurus (I freakin' LOVE this site)

As I mentioned in a recent question, I'm helping a friend launch her blog and she picked a child theme from Genesis to use.

She wants a "Tweet this" button (the native Twitter one that makes the t.co URLs) under each post.

I've got that working on the individual post page like so:
[[LINK href="http://theselittlewaves.com/2011/02/20/these-little-waves/"]]http://theselittlewaves.com/2011/02/20/these-little-waves/[[/LINK]]

I'm using the WP Twitter button plugin for that:
http://wordpress.org/extend/plugins/wp-twitter-button/

<strong>Here's the catch (question):</strong>

She also wants it to show on on the home page (and category pages) that shows the most recent X number of blog posts. She wants it to show underneath each individual post, floated to the right, just like on the individual post page.

So if you [[LINK href="http://theselittlewaves.com/"]]look at the homepage now [[/LINK]]and scroll to the end of the post shown there, you'll see a Facebook like and a Facebook Share button. To the right of that is where she'd like the Tweet button to go. Same for the [[LINK href="http://theselittlewaves.com/category/book/"]]books category[[/LINK]].

Any idea of how to do this with Genesis (I usually just edit the templates, but that doesn't seem possible in Genesis)?

Is there a different plugin that I could use that would make it show up on the homepage and categories as well?

Answers (5)

2011-02-21

Ivaylo Draganov answers:

Hello,

I'm not familiar with Genesis but it is possible to override templates by using [[LINK href="http://codex.wordpress.org/Child_Themesl"]]Child Themes[[/LINK]]. You have to create a child theme which uses Genesis as parent. To do that you just create a new theme as usual but add this line to <em>style.css</em>:
template: genesis

Maybe Genesis provides some way to override parts of templates. Via action and filter hooks probably. You have to check in with Genesis' documentation.

As for the Twitter button you can use the code provided by Twitter:
[[LINK href="http://twitter.com/about/resources/tweetbutton"]]http://twitter.com/about/resources/tweetbutton[[/LINK]]

You just have to specify a <em>data-url</em> and <em>data-text</em> attributes for the <a> element because by default the Tweet button will use the current page URL and title. You should use WP's template tag <em>get_permalink</em> to get the post's URL and <em>the_title</em> for the post's title. Something like that:


<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-text="<?php the_title(); ?> data-count="vertical">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>


That code has to be placed inside a WP loop. If you want to have that for a long list of posts, you should use just one <em><script></em> element. Best placed at the end of the page (before <<em>/body></em>).

2011-02-21

Vidyut Kale answers:

Hook the code to "genesis_after_post"

Something like

add_action('genesis_after_post' , 'sweety_tweety');
function sweety_tweety() {
echo "Insert button code of choice";
}

Style as needed in your regular style.css file.

2011-02-22

Rashid Aliyev answers:

Find part of code where the post printing. And add line of twitter after it. If possible write address of your site to look to code (HTML) and after i can write correct place and correct code. But simplest, you can use chevreshare or analog sharing plugin.

2011-02-22

Rashad Aliyev answers:

Hello,

I suggest you my own sharing plugin. ( [[LINK href="http://wordpress.org/extend/plugins/cevhershare/"]]http://wordpress.org/extend/plugins/cevhershare/[[/LINK]] )

After setup this plugin then you can use it on the left or right sidebar or you can put the code on your theme (single.php or page.php )

For example using special codes for your site. You can also using "big" or "small" size for facebook, twitter, digg, buzz etc.

<?php cevhershare_button('name','size'); ?>

You can get more information: [[LINK href="http://wordpress.org/extend/plugins/cevhershare/"]]http://wordpress.org/extend/plugins/cevhershare/[[/LINK]]

2011-02-22

Gabriel Reguly answers:

Hi,

WordPress has it's own plugin for this task.

It is very flexible and easy to use.

Please find it at

http://wordpress.org/extend/plugins/sharedaddy/

Regards,
Gabriel