In reply to https://starrwulfe.xyz/9730-2/. Is there a …
In reply to
.Is there a way to expand the context block to handle all the other post kinds?
Good question. I had some plans, but—just have a quick glance at my “notes” section—since I mostly use these three or four types, that’s what I went with. I wanted to do different blocks, but they would share so much code that it kinda made sense to just “merge” them into one.
That said, I’m looking into nesting other (Paragraph, etc.) blocks to avoid having to explain to people that, for “notes,” they probably want Context blocks followed by a Group block with an e-content
class, or go find the right block templates and so on. (I mean, you don’t have to; it’s just I prefer the way most Microsub readers treat that sort of setup.) Anyhow, if I ever go there, I may have to “split up” the Context block anyway.
So, yeah, new blocks (or “kinds”) are certainly an option. RSVP would be nice. Reads, too, perhaps (although I’ve yet to use them).
Another thing I started but then halted is more elaborate “contexts,” where I show not just a URL, but a title and author, too. (Part of it is still there in the code, in fact.)
Can you tell me how you’re doing your editing?
I use both WP-Admin and a Micropub app (Indigenous, I’m on Android). Sort of 50–50. On my one blog, I use the classic editor and a “text expander” to help me hand-type HTML and microformats. On another, it’s the block editor and Context block (plus the occasional Columns and Image blocks, etc.). My notes support Markdown, too.
This way, my posts’ “kinds” are inferred by the actual microformats in them, rather than determined by an explicit taxonomy. I really wanted my “notes” to cover also quick replies and “bookmarks” or “quotes,” have everything in a single “timeline.” (My goal was for it to be like Twitter, yes.)
Also what plug-in or custom coding are you using to show the weather and shortlink?
The weather bit, or part thereof, is actually IndieBlocks; it’s “hidden” behind the “Location and Weather” option (Settings > IndieBlocks > Miscellaneous). This will add a “Location” meta box to (by default) posts and notes. (It should also work with Microsub latitude and longitude coordinates.) Weather data is pulled from the OpenWeatherMap API, and uses the location information.
This does require, however, a (free) API key, which you should add to wp-config.php
like so: define( 'OPEN_WEATHER_MAP_API_KEY', 'your-actual-api-key' );
.
The tricky bit, however, is this: there’s currently no easy way to get the weather data out of WordPress’s wp_postmeta
table. I’m going to have to add that, and document this part of the plugin.
Meanwhile, and this may actually your best bet, you should definitely check out David Shanske’s Simple Location plugin, which is where I got the idea in the first place! (It is much more feature-rich, too.)
The shortlinks, then: I host my own super simple URL shortener, but there’s plenty of other solutions. I call it whenever a new post is published; it returns a shorter URL, which I again store as post meta. I’ll likely blog about this part in the near future! (In my theme—it’s not really a theme, but whatevs—I fetch this URL and output it. get_post_meta( $post->ID, 'short_url', true )
, that’s about it.)
cagrimmett.com on
… liked this!