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

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


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 ...


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

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

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

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

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 ...


1

How to do remote requests in WordPress: Use the appropriate API First, there's the WP HTTP API, which should be used for such tasks. And second, one should never ever use the @ operator, as this one suppresses error messages or notices and will successfully lock you out from troubleshooting your bugs. Just because you can't see it, doesn't mean that it's ...


1

$post isn't available during {$new_status}_{$post->post_type}, but $post_ID is. We pass that to the function and then call in $post globally. I should have also been testing using get_post_format(), not for a type. After those corrections, everything seems to be running smoothly with the caveat that if the post is not auto-saved or saved as a draft ...


1

My guess is that you aren't hitting the {$old_status}_to_{$new_status} action, which is what you are hooking to with draft_to_published - for new posts there is no guarantee that the "old" status is actually "draft". Have you tried using the {$new_status}_{$post->post_type} action, which in your case would be publish_status?


1

There is a jQuery event hooked to that link. Here is the function that is called whenever you click one of the sharing links: function (){ window.open( jQuery(this).attr( 'href' ), 'wpcomtwitter', 'menubar=1,resizable=1,width=600,height=350' ); return false; } This is added by the JetPack plugin and will attempt to open a dialog window with the ...


1

It's part of the Webzine theme - if you take a look at the source, near the bottom, there's a rather hefty chunk of JS that queries Twitter & renders the tweets. Now whether that code is sat there waiting for you in footer.php, or called in from somewhere else, I don't know - if the latter, you'll have to root around the theme folder to find it! It's ...


1

Mashable Follow is custom built for Mashable.com, so you won't find a plugin that brings that level of integration to your WordPress site. That said, there are two that may suit your purpose: Social: Integrates your WordPress site with social networking sites Twitter and Facebook, thereby offering a whole lot of features including—automatically ...


1

You have two options: The easy way is to install an extension that puts these buttons on your posts. You can search wordpress.com's plug-ins database, here is an example, but there are many more: http://wordpress.org/extend/plugins/really-simple-facebook-twitter-share-buttons/ You can also search for these from within your Wordpress admin interface to ...


1

Sure... there are several wordpress plugins that enable Social login with numeros social websites.. here are a couple: WordPress Social Login Social Login THe second one includes Open ID... Hope this helps, Sagive.


1

Here is a bait-and-switch approach to deleting all those rows: CREATE TABLE wp_posts_new LIKE wp_posts; ALTER TABLE wp_posts_new DISABLE KEYS; INSERT INTO wp_posts_new SELECT * FROM wp_posts WHERE post_type'http' AND post_title<>'GET http://twitter.com/statuses/user_timeline/@xcentric.json?count=100'; ALTER TABLE wp_posts_new ENABLE KEYS; ALTER TABLE ...


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