Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

13

This is a little tricky because sanitize_user allows spaces in usernames, meaning it difficult to avoid grabbing the whole phrase '@johndoe said that ... ' as opposed to just the actual username '@johndoe' and you have no separator at the end that would help. To avoid that I imposed a requirement that spaces in the username be replaced with '+'. function ...


8

You need to do this in steps: Decide when you are going to parse the user's meta to change the value. Define a function to do that. Hook that function to the appropriate action. The original answer defined what you need to do for step #2, using preg_match() to parse the Twitter URL and extract the username. function update_the_user( $user ) { // ...


4

I use disqus on my site and it works quite well.


4

I've managed to find a solution to my problem. I solved it with three plugins Members User Role Editor Social Login The combination of these plugins allows you to who can log in, without telling them how to log in. More specifically, anyone will be able to log in with a social network, but they won't be able to see everything. With User Role Editor, you ...


4

As the author of Twitter Tools, I can confirm it is alive and well. Twitter Tools 3.0 beta 2 was released earlier this year: http://alexking.org/blog/2012/01/22/twitter-tools-3-0-beta-2 Now that Social 2.5 is out, a final release of Twitter Tools 3.0 will be available once we have some time to finish testing. You can always grab the latest version from ...


4

Look at the P2 theme. It does this, calling them "Mentions". http://themes.svn.wordpress.org/p2/1.4.2/inc/mentions.php


3

Both Simple Facebook Connect and Simple Twitter Connect have features to allow users to post comments using their Facebook or Twitter credentials. Among other things. Disclaimer: I wrote 'em both.


3

The problem is that get_the_title() will pass the title through a filter that texturizes the quotes. So a regular " becomes a curly quote (“) and urlencode() will break it. So instead, write your own title function and use that: function my_get_the_title() { global $post; return $post->post_title; } This should bypass any unwanted ...


3

I reworked (added another version of) my function to remove the if statement to check post status, as the post is scheduled to publish it turns out i don't need to check it again. /* the function */ function tcr_tweet2($postID) { /* get the post that's being published */ $post = get_post($postID); $post_title = $post-&...


2

I finally, got it; <?php echo tweetbutton(); ?>


2

Looks like you've mis-named the function. It is the_tweetbutton(), rather than tweetbutton(). Also, you should always wrap Plugin-added function calls in if (function_exists()) conditional wrappers. Putting that together, this: <div id="tweet-button"> <?php tweetbutton(); ?> </div> Becomes this: <div id="tweet-button"> ...


2

That is one nasty regexp. I would suggest looking into Twitter entities instead, much easier than trying to parse it yourself. And this really has little to do with WP and more suitable for other sites in network.


2

Hi Rob@:try with this plugin Tweet This.you can set your custom image also.:) or Try this code... Open the sidebar.php Locate the “twitter-feed” div <div class=”twitter-feed”> <h2>What I’m up to…</h2> <ul id=”twitter_update_list”></ul> <script type=”text/javascript” src=”http://twitter.com/javascripts/blogger.js”></...


2

The easiest way of doing this is to use a slightly undocumented feature of twitter's search - you can pull an Atom feed for any search query (which includes hashtags), and then use FeedWordPress to generate posts. A sample Twitter search query that returns Atom (which is is an alternative to RSS and works in the same way): https://search.twitter.com/search....


2

Ouch, that snippet is ancient (I am kinda its author, more precisely adapted to twitter from other snippet). I would strongly consider using some newer solution. I had later made newer and written from scratch version, try it http://www.rarst.net/script/twitter-counts-wordpress/


2

Two issues: The code you're using requires Administrator-role capabilities The code you're using requires fopen() wrappers, which may be disabled by your host You should probably be using wp_remote_get() instead of file_get_contents(). I would also recommend caching the result, rather than storing it as a DB option. But, let's start with the basics. I'm ...


2

Disqus is a popular cross-site comment system which allows logging in via various methods, including Twitter, Facebook and your own disqus account. They obviously have their own Wordpress plugin you should check out.


2

In your dashboard, go to Settings > Sharing, and drag the available social networks into the "Enabled Services" area to accomplish this. See http://en.blog.wordpress.com/2010/08/24/more-ways-to-share/.


2

This might help you out if you haven't found an answer yet. /* BEGIN Custom User Contact Info */ function extra_contact_info($contactmethods) { unset($contactmethods['aim']); unset($contactmethods['yim']); unset($contactmethods['jabber']); $contactmethods['facebook'] = 'Facebook'; $contactmethods['twitter'] = 'Twitter'; $...


2

There are 2 ways to do this. The first is to create a function that outputs the buttons and then include it in your template. The second is to add a filter to either the_content or the_excerpt or both depending on where you want the buttons to show up. In either case the first thing you need to do is separate out the script calls from the code that ...


2

Have you tried Simple Twitter Connect and Simple Facebook Connect.


2

I use the following code to intrude myself into WPTouch until I buy a licence :) Better than simply hiding other plugins is disabling everything you can of it. And the visitor gain less (and unnecessary) elements to load in their device. The insert_scripts is pretty straight forward, adjust to your needs. The remove_scripts I did from a fast analysis of ...


2

ok, got it. Need to embed <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script> manually And then fire twttr.widgets.load(); after appending the posts. Thx anyways, Rarst


2

This is because of a variable mismatch. Your function accepts $post_ID, but you don't actually use it. You're instead trying to reference a global $post object and doing your post format check with $post->ID. With the XML-RPC request, this won't work. Rewrite your function to use get_post() to fetch a post object from the passed-in ID: function ...


2

In the insert_posts function, before the line $post_id = wp_insert_post( $post ); add the following (and suit to your needs): Link to Twitter User Page $post['post_content'] .= '<a href="http://twitter.com/__USERNAME__">' .'Follow me on Twitter' .'</a>'; and/or Link to Twitter Status $post['post_content'] .= '<a href="'.$post['...


2

The mark-up surrounding the widget is malformed. IE isn't handling this as well as other browsers. <h1>Twitter</h1><h2><a href="http://twitter.com">Follow</h2> <div><h2><span class='twitterwidget twitterwidget-title'> Note the opening anchor tag before "Follow". This is never closed.


2

There is an extra action hook for scheduled posts: publish_future_post - it isn't very good documented though. There are occurrences of the hook in: /wp-includes/default-filters.php /wp-admin/includes/upgrade.php /wp-includes/post.php The hook invokes check_and_publish_future_post(). Read the linked information, if you want to inform yourself further. ...


2

I've used add_action ('transition_post_status', 'my_action'); and it works great for both posts that are published directly or in the future. The function my_action being: function my_action ($new_status, $old_status, $post) { if (($old_status != 'publish') && ($new_status == 'publish')) { // doing things. } }


2

WordPress has a core function human_time_diff that does what you want, using it with the filter you provide you have someting like so: add_filter('latest_tweets_render_date', function( $created_at ){ $date = DateTime::createFromFormat('D M d H:i:s O Y', $created_at ); return sprintf( '%s ' . __( 'ago' ), human_time_diff( $date->format('U') ) ); }...


2

Here's one way using the oembed_fetch_url filter to add the hide_media query parameter, that's also mentioned in the Twitter doc page you linked to: Set an oEmbed query parameter of hide_media=true or add a data-cards="hidden" attribute to the resulting <blockquote> element to prevent expanded content display. Here's an example: /** * Hide ...


Only top voted, non community-wiki answers of a minimum length are eligible