Making Tweet-Based WordPress Posts Easier: Hacking “Twitter Digest”

Before my recent blogging hiatus, I was using an only slightly hacked version of the WordPress Twitter Digest plug-in to put together posts collecting my twitter traffic. I stuck for a couple of months with what amounted to a one-sided version of my twitter time-line, and, in trying to close in on what I had envisioned, I found myself spending inordinate time and energy concocting summaries, and collecting and formatting images. I considered various methods for refining the output, and expect still to work up an improved version of the plug-in, but in the meantime I stumbled upon an easy way to turn the plug-in into a tool for quickly turning tweets into blog posts. I also have not yet gotten around to address the truncated RT issue that I’ve previously discussed.

What I wanted was an easy way to assemble recent tweets of interest – especially the kinds of tweets that, put together, construct arguments or outlines of arguments potentially worth discussing further or expanding upon more intensively. For now all I want is a tool for collecting tweets quickly and having them automatically placed in a draft post, in a form that I can easily manipulate. Eventually, we’ll get to a slimmed-down version with only the code we need, amounting to an entirely separate plug-in – “Tweet-Poster” or something with its own tailored dashboard – but here’s the brute force hack, based on the assumption that you have already fully installed and set up Twitter Digest – though, just in case it doesn’t go without saying, hacking it this way means making it useless for its intended functions:

1) Open twitter-digest.php in the WordPress Plug-In Editor (i.e., Plugins/Editor/twitter-digest.php), or copy it into a code editor like NotePad++.

2) Scroll down to or search for the note “Was this tweet added in the time period of interest?”(around line 160).

3) Comment out the two if- statements. The results might look like this:

4) Save the file in the Plug-In Editor.

5) Open Twitter Digest from under WordPress dashboard Settings

If Twitter Digest is already installed and working for you, you must have Twitter Account Info already filled out. If not, you’ll have to acquire the needed keys/codes/tokens before going any further.

Under “Publish Options” leave “Time of Day” blank, and handle the “Post Options” however you like. Give the post a title and, since you likely won’t want to have the “take” published automatically as is, set “Post Status” to “Draft.”

6) Enter number of tweets to retrieve

Note that we’re using this only as a tool for simplifying the retrieval of multiple relatively recent tweets: Twitter limits how many you can retrieve at a time to 200, so, if you’re interested in going further back, you’ll have to use some other method – like Storify or a Twitter Archive download – to get your tweets from even a few days ago.

Let’s say there was a series of tweets from around 50 tweets ago that you know you’re going to want to work with. Enter “100” after “Maximum number of tweets to retrieve,” just to give yourself a margin for error, then click “Update Options.”

7) Reset Database

Twitter Digest is set up to avoid duplication. Our future “Tweet Scraper” or “Tweet Poster” plug-in won’t need this feature, but, if you’ve done this already, or just to be safe, click “Reset Database.” Otherwise, the new retrieval will start (or end, depending on how you look at it) wherever the last one left off. (If you haven’t done any tweets since the last retrieval, you won’t get anything this time.)

8) “Ping Twitter”

Twitter Digest will tell us that a “Post containing yesterday’s tweets has been drafted,” and will tell us in green letters. In “Tweet Poster”‘s new dashaboard, I think we’d like to have it provide us with a link to the new post.

I’ll instead have to find it near the top of the Posts screen. Once I open it, I’ll have a list of my most recent 100 tweets in chronological order. It will be easy to delete the lines above and below the tweets I want, to produce a post or posts with the remaining material: Hack-Mission Accomplished.

10) Reset Options

If you leave our hacked Twitter Digest with the settings as above, it will continue to produce new draft posts continually, tweet by tweet, periodically. I’m not sure what initiates the retrieval, actually, and how it relates to behavior intended by the plug-in author. For the moment, I’m leaving “Minimum tweets required for a post” at “200,” and “Time of Day” under “Publishing Options” at “24:00.” I’m guessing that will prevent the unwanted post drafts from being created while I continue to research the matter.

Home Page  Public Email  Twitter  Facebook  YouTube  Github   

Writing since ancient times, blogging, e-commercing, and site installing-designing-maintaining since 2001; WordPress theme and plugin configuring and developing since 2004 or so; a lifelong freelancer, not associated nor to be associated with any company, publication, party, university, church, or other institution. 

Commenter Ignore Button by CK's Plug-Ins

Leave a Reply

Your email address will not be published. Required fields are marked *



Noted & Quoted

TV pundits and op-ed writers of every major newspaper epitomize how the Democratic establishment has already reached a consensus: the 2020 nominee must be a centrist, a Joe Biden, Cory Booker or Kamala Harris–type, preferably. They say that Joe Biden should "run because [his] populist image fits the Democrats’ most successful political strategy of the past generation" (David Leonhardt, New York Times), and though Biden "would be far from an ideal president," he "looks most like the person who could beat Trump" (David Ignatius, Washington Post). Likewise, the same elite pundit class is working overtime to torpedo left-Democratic candidates like Sanders.

For someone who was not acquainted with Piketty's paper, the argument for a centrist Democrat might sound compelling. If the country has tilted to the right, should we elect a candidate closer to the middle than the fringe? If the electorate resembles a left-to-right line, and each voter has a bracketed range of acceptability in which they vote, this would make perfect sense. The only problem is that it doesn't work like that, as Piketty shows.

The reason is that nominating centrist Democrats who don't speak to class issues will result in a great swathe of voters simply not voting. Conversely, right-wing candidates who speak to class issues, but who do so by harnessing a false consciousness — i.e. blaming immigrants and minorities for capitalism's ills, rather than capitalists — will win those same voters who would have voted for a more class-conscious left candidate. Piketty calls this a "bifurcated" voting situation, meaning many voters will connect either with far-right xenophobic nationalists or left-egalitarian internationalists, but perhaps nothing in-between.

Comment →

Understanding Trump’s charisma offers important clues to understanding the problems that the Democrats need to address. Most important, the Democratic candidate must convey a sense that he or she will fulfil the promise of 2008: not piecemeal reform but a genuine, full-scale change in America’s way of thinking. It’s also crucial to recognise that, like Britain, America is at a turning point and must go in one direction or another. Finally, the candidate must speak to Americans’ sense of self-respect linked to social justice and inclusion. While Weber’s analysis of charisma arose from the German situation, it has special relevance to the United States of America, the first mass democracy, whose Constitution invented the institution of the presidency as a recognition of the indispensable role that unique individuals play in history.

Comment →

[E]ven Fox didn’t tout Bartiromo’s big scoops on Trump’s legislative agenda, because 10 months into the Trump presidency, nobody is so foolish as to believe that him saying, “We’re doing a big infrastructure bill,” means that the Trump administration is, in fact, doing a big infrastructure bill. The president just mouths off at turns ignorantly and dishonestly, and nobody pays much attention to it unless he says something unusually inflammatory.On some level, it’s a little bit funny. On another level, Puerto Rico is still languishing in the dark without power (and in many cases without safe drinking water) with no end in sight. Trump is less popular at this point in his administration than any previous president despite a generally benign economic climate, and shows no sign of changing course. Perhaps it will all work out for the best, and someday we’ll look back and chuckle about the time when we had a president who didn’t know anything about anything that was happening and could never be counted on to make coherent, factual statements on any subject. But traditionally, we haven’t elected presidents like that — for what have always seemed like pretty good reasons — and the risks of compounding disaster are still very much out there.

Comment →
CK's WP Plugins


Extraordinary Comments

CK's WP Plugins