Hi, please

Tag Archives: wordpress

WordPress 2.7 is out, improvise…

Go get it while it’s hot!

My Wordpress Questions

I also had a few questions about Wordpress that we didn’t have time to answer in today’s class.

  1. We touched on it in Class a bit with Karen’s site but never came to a solution. Currently i have the Navigation in the white strip inside header.php. No matter what page you visit this looks the same. I was hoping to have the section you were currently on be highlighted. That part seems fairly simple but in addition to changing the look of the section title i was hoping to have a accordion type effect where for example the WORK section would extend to show a submenu, consisting of 3 or 4 links. I know i can achieve this through taking the navigation out of the header.php and including it individually on each page template. I’m pretty sure there is a much more “elegant” way of doing this that i am missing.
  2. In the BLOG section when you are in a “single page” you have the option to click “next post” and “prev post” and they are working as i would like. Since I am using the query_post fuction to hide all of the posts that are filed under the category “portfolio”, the next and prev buttons still find those “portfolio” posts (which dont even follow the same “single” template, which causes you to leave the blog unexpectedly).

I have searched around briefly but thought i would post to see if someone knew the answers to these questions before i spent hours looking for solutions. I’m almost there!

Thanks,

Getting the first image from a Wordpress post

Here’s a Wordpress code snippets I thought you might find useful. It is a functions you can dump in functions.php and then use in your theme. This one would get you the first image from any post you pass it. This is a great way for you guys to get thumbnails for your posts without extra effort. Here we go:

Snippet

Paste this code into anywhere in your functions.php file

function get_first_image($post_ID, $fullsize=false, $max_dims=false){
	$thumbargs = array(
	'post_type' => 'attachment',
	'post_status' => null,
	'post_parent' => $post_ID
	);
	$thumbs = get_posts($thumbargs);
	if ($thumbs) {
		$num = count($thumbs)-1;
		return get_attachment_innerHTML($thumbs[$num]->ID, $fullsize, $max_dims);
	}
}

Parameters

This function expects to be passed three parameters: $post_ID The ID of the post you want the first image for (you can get it easily from the loop for example) $fullsize Are you trying to refer to the full size image? [true] or to the thumbnail [false]. Default: false $max_dims Do you want to make the image resize proportionally? If so, pass a single number [300] to limit it equally on both height and width or pass an array of two values, width and height [array(300,200)] to have different height and width size limits. If you don’t want to limit size pass false. [false] Default: false

Returns

This function would return the img tag with the alt tag, image resizing and all. So putting this in your theme:

get_first_image (35, true, array(300, 350));

Might return this:

  <img title="my image title" src="http://artfocus.org.il/en/wp-content/uploads/2008/08/durham-jd_coll-stones_brasilian2.jpg" alt="my image description" width="300" />

In this case http://artfocus.org.il/en/wp-content/uploads/2008/08/durham-jd_coll-stones_brasilian2.jpg is the full sized image, and being of landscape proportions it is being its size is being resized to proportionally fit the 300px width. If it would have been a vertical image, it might have resized by the 350px height and then its width might resize to less than 300px. Enjoy.

Thanks

Thanks to Crerem and Ben Colman, for providing bug report and patches to the code (thrugh the comments)

OK Indexhibit, let’s make you better

Indexhibit:

  • Write a CSS Plugin for Indexhibit, please communicate with the rest of us what your plugin will be about.
  • Chip in on the documentation for the Sandbox theme
  • Let’s communicate about our Friday gig.

Wordpress:

  • Start diving into plugins.
  • Make your theme links url independent.
  • Upload content to your blog.
  • Get ready to finish this thing.

Enjoy

WPing & OSDing

As our process becomes more self-directed, I do not have any specifics for you for next week but:

  • Continue down the WP path:
    1. try to finish the main page
    2. Next go to post page (single.php) (+ if relevant: comments.php)
    3. Then to page page (page.php)
    4. Then to the menus (archive.php archives.php author.php category.php tag.ph)
    5. Then to search (search.php)
    6. Last (/optional): 404.php, attachment.php, image.php, links.php)
  • Let’s get our heads into Indexhibit and how can we make it better:
    1. We’ll discuss it in class today
    2. Let’s share some findings from the Indexhibit forum that can shed some light on where to take this
    3. Let’s experiment with theming Indexhibit, it’s not hard, how can it be easier?
  • Leonie will be back next week with a ‘Great Wide Open’ for us.
  • Enjoy

If it’s not too late.

Changed the gradient a bit, looks a bit better now. Also the PSD attached.

wp_icons_edpsd

*UPDATE – added seperation between ribbon

Interesting & Helpful Adobe CS4 Feature

Has anyone seen or heard about this feature in CS4? Basically when you get to a certain zoom level (+500%) it shows an automatic pixel grid. It’s pretty useful and exciting! (wow, i really sound like a major nerd)

Dashboard & Links + PSD

Some progress made… please send your feedback, or take a pass on The PSD

The slightly revised posts icon + congratulations!

Exciting times… (good choice if I may say so)

Ok, here’s the PSD file for the twicks we’ve been making to the posts icon yesterday.

+Karen, please use this screenshot for the list/excerpt mockup:

I will post some sketches for the dashboard icon later today.

Congrats!

Another go at it.

Here is a zip file of my working files.

I tried to refine them a bit more, but I think they still need more work. Let me know what you guys think.