New theme by me is live.

I’ve done some minor changes to the theme I was using as the parent (Portfolio Press), and I just put them live on the site. Most notable are the color changes. I added blue accents in the header & footer, and separated the menu using relative positioning, along with a border-radius style.

I wrote a function to generate a copyright notice, which you can see in the footer. This was probably what took me the longest, as WordPress doesn’t have the direct function to get the earliest post. Here’s the code below:

function copyright($arg0 = NULL) {
    $copyright_holder = $arg0;
    if($copyright_holder == NULL){
        $copyright_holder = get_bloginfo();

    //  Get the first post and date.
    $first_post = get_first_post();
    $first_post_date = date_parse($first_post->post_date);
    $start_year = $first_post_date['year'];

    $last_post_date = date_parse(get_lastpostdate());
    $end_year = $last_post_date['year'];
    _e("Copyright © " . $start_year);
    if($start_year < $end_year){
        _e(" &dash; " . $end_year);
     _e(" " . $copyright_holder . ". All rights reserved.");

 * Retutns the earliest post of the blog.
function get_first_post(){
    $args = array(
        'numberofposts' => 1,
        'orderby'       => 'date',
        'order'         => 'ASC'
    $list = get_posts( $args );
    $mypost = $list[0];
    return $mypost;

The argument passed to copyright can be anything, but ideally should be the copyright holder’s name. You can even wrap it in a link like I did. If no argument is given, the name of blog will be used. The year range in generated by querying the earliest post via get_posts and the latest post via get_lastpostdate. The function account for the case that range falls only on a year. I’ll integrate this as easy to configure option within the admin interface later.

Edit: Fixed something that was giving warnings. I can’t figure out how to get the ampersand to appear.


About imaginationac

I make things with computers.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s