Categories
General

How to change the photo border

Paul asked how to change the border around images. I’m not sure whether he wanted to know for flickpress or Photopress, but it doesn’t really matter. Photopress adds a custom CSS class to images it inserts, but most likely you’d want to change the appearance of all images in your posts, no matter which tool inserted them.

You’ll need to edit your theme’s style file, which you should be able to do as an admin at Appearance -> Editor. It should bring up the Stylesheet, but if not it’ll be in the list on the right side. You need to add something like this:

a img {
padding: 2px;
border: 2px solid #ccc;
}

a:hover img {
padding: 2px;
border: 2px solid #c33;
}

The “hover” part will make the border change on mouseover – if you don’t want that then leave it out. The “padding” part adds a gap between the image and the border. This only adds borders for linked images. If you want borders for all images, whether they’re linked or not, do something like this:

img {
padding: 2px;
border: 2px solid #ccc;
}

You probably just want this to affect images in posts, not the images in your header or sidebar. It depends on your theme, but most themes wrap each post in a “div” element with the class “post” – this will restrict the change to images in that class:

.post img {
padding: 2px;
border: 2px solid #ccc;
}

If in doubt, view the source of your site to see what you might be able to use – there’s often a “div” with the id “content” that wraps the whole content area.

Categories
General

OrgPress Theme 0.3

This version fixes a few problems I found with navigation – sometimes I was using the wrong template tags, sometimes I just didn’t have the navigation stuff in the right place. Hopefully it’s all fixed now.

Next, as I noted in the previous post, I think it makes sense to link to fancy author pages whenever possible. So, I added code to the comment function to link to logged-in commenters’ author pages.

In addition to refining the author template a bit, I added some code to display links to Facebook and Twitter if the user has entered those. You’ll need a separate plugin to add those fields to their profile, such as Twitter Profile Field or Profilo.

Download OrgPress 0.3: orgpress_0.3.zip

Categories
General

OrgPress Theme 0.2

This version adds the quick posting thing I mentioned in an earlier post, with some tweaks based on how it’s been working at my group blog. It’s fun and popular, but we decided to keep the quick posts separate from the regular posts, putting them in a sidebar block instead. Not much else has changed – just a couple of fixes to the archives.

Download OrgPress 0.2: orgpress_0.2.zip

Categories
General

Adding a quick post box to your theme

Since I added a sidebar login form to my group blog, I’ve wanted to add a way for logged-in folks to make a quick post without going to the WordPress backend. I learned about the Prologue theme via a Twitter post about its successor, P2. There’s a comment at Lorelle’s blog pointing to where to get P2 via SVN, but it’s pretty complicated AJAX-y and JSON-y stuff – the original Prologue looked much easier to borrow from.

First, you’ll need the post form. You can put the form directly in your index.php, or it in a separate file (I called it post-form.php):

<?php $user = get_userdata( $current_user->ID ); ?>

<div id="postbox">
<h3><a class="togglepost" style="cursor:pointer">Make a quick post &raquo;</a></h3>
<div class="showhidepost">
<form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/">
<input type="hidden" name="action" value="post" />
<?php wp_nonce_field( 'new-post' ); ?>
<textarea name="posttext" id="posttext" style="width: 100%;"></textarea><br />
<strong>Title:</strong> <input size="40" type="text" name="posttitle" id="posttitle" /> <input id="submit" type="submit" value="Post it &raquo;" />
</form>
</div>
</div>

Next, add code to detect a logged-in user with publishing permission, and either include the form or echo it out:

if( current_user_can( 'publish_posts' ) ) {
require_once dirname( __FILE__ ) . '/post-form.php';
}

Finally, add some code to your index.php to process submitted posts:

if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'post' ) {
if ( ! is_user_logged_in() )
auth_redirect();
if( !current_user_can( 'publish_posts' ) ) {
wp_redirect( get_bloginfo( 'url' ) . '/' );
exit;
}
check_admin_referer( 'new-post' );
$user_id = $current_user->user_id;
$post_content = $_POST['posttext'];
$post_title = $_POST['posttitle'];
$post_id = wp_insert_post( array(
'post_author' => $user_id,
'post_title' => $post_title,
'post_content' => $post_content,
'post_status' => 'publish'
) );
wp_redirect( get_bloginfo( 'url' ) . '/' );
exit;
}

Prologue has a tags field, which I replaced with a title field – it’d be easy to add any of the fields from the backend posting form you think are important. It might also be interesting to make a template for a quick post page separate from the main blog, like a bulletin board. I think for that I’d put back Prologue’s auto-title feature, and add a hidden category field to make it easy to filter quick posts off the main blog.

Categories
General

OrgPress Theme 0.1

I’ve been using a hacked-together combination of the two WordPress default themes and some group-oriented customizations at my own family blog for a while now. It took some work to clean it up for release, and there are probably some bugs left to work out, but here it is. I turned it on here for fun, but I’ll probably make a different version based on it for this site…I miss the horizontal menu. Some of the main features include:

  • Widget-friendly sidebar
  • Avatars all over the place
  • Threaded comments
  • Theme options page
  • Optional sidebar login form
  • Optional random headers
  • A LOT of reminders and links for users to log in
  • Automatically uses Compact Archives if it’s installed
  • Automatically uses Most Commented if it’s installed

Download OrgPress 0.1: orgpress_0.1.zip