A completely plaintext WordPress Theme
This is a silly idea. But it works. I saw Dan Q wondering about plaintext WordPress themes - so I made one.
This is what this blog looks like using it:
The Code
You only need two files. An index.php
and a style.css
. The CSS file can be empty, but it needs to exist - otherwise WordPress won't let you activate the theme.
The index file displays the requested post, or front page, in plain text. It isn't the most sophisticated code I've ever written!
PHPheader('Content-Type: text/plain; charset=utf-8');
bloginfo( 'name' );
echo "\n\n";
if ( have_posts() ) {
while ( have_posts() ) : the_post();
if ( get_post_type() == 'post' ) {
the_time( get_option( 'date_format' ) );
echo "\n";
}
the_title();
echo "\n";
echo strip_tags( apply_filters( 'the_content', get_the_content() ) );
echo "\n\n\n";
endwhile;
}
Obviously, there are no links - so you can't navigate. There are no images - but there's also no alt text. There are no embeds, scripts, styles, or other fancy things. Just plain text.
Enjoy!
Dan Q said on danq.me:
Terence Eden took my idea for a completely plain text blog, ran with it, and just kept running. Now it's a WordPress theme!
Daniel Pavey said on toot.community:
@Edent love it! nice ❤️
Salvatore Zummo said on www.univocal.co:
Some weeks ago my attention was caught by an interesting and strikingly original feat accomplished by Terence Eden with a blog post titled “A completely plaintext Wordpress theme”: In short, the author was able to condense the basic output of a Wordpress classic theme in less than 15 lines of ...
More comments on Mastodon.