Bittersweet: a free SharePoint Master Page for blogs

Bittersweet Master Page (SP2010)

I’ve been inspired lately to create a Master Page for a SharePoint blog. It’s based on Kyle Schaeffer’s V5 Master Page, and I’m giving it away free in return for feedback and critique. I’d love to develop this further and take it to team sites, my sites, and publishing pages, but before I go through the whole process I’d like to gauge interest.

Features:

  • CSS3 rounded corners
  • fonts: “Shadows Into Light Two” and “Open Sans” (courtesy Google Webfonts)
  • an HTML5 shiv for older browsers
  • Fixed width, centered design

So download, enjoy, and tell me what you think!

Download: Bittersweet Master Page (SharePoint 2010) (11.7KB, ZIP)

Ben


Custom background not appearing after updating to WordPress 3.3

I recently updated WordPress on a site I’m working on to version 3.3 (using a Thematic child theme), and now my custom background has disappeared. I’ve been scouring the internet and haven’t come up with anything. Anybody know what’s up with this?

Anything knew I find I’ll post here. I’ve also started a thread in the wordpress forum.


Add a custom footer menu in a WordPress Theme

* 1 Comment

Put this code in your functions.php

register_nav_menus(
  array('footer' => __( 'footer-menu', 'THEME_NAME' ),)
);

Then go into WordPress and add a new menu. Call it “footer”.

Then on the left side, you’ll now see a drop-down menu to set a footer menu. Select the “footer” menu you just created.

Finally, go to your footer.php file and call the menu using the following code:

<?php wp_nav_menu( array( 'theme_location' => 'footer' ) ); ?>

Add a NextGen Gallery in your theme

This is how to display a NextGen gallery in any page in your theme.

nggShowSlideshow(galleryID, width, height)

<?php echo nggShowSlideshow(2,700,228) ?>

Try it out!


WordPress + Nextgen Gallery: Load Lightbox Gallery From One Image

* 24 Comments

This is an explanation of how to have multiple galleries on a page, yet only show one thumbnail, and that thumbnail shows all of the images in the gallery…in the lightbox view. Phew, it’s hard enough just to write out. But after trawling through the internet looking for the answer, I’ve jimmy-rigged it myself. I don’t know that I’d call it a hack…but at least your page load time isn’t affected. So here goes!

##UPDATE: I’ve just recorded a screencast for this tutorial, click here.

1. Install the NextGen Gallery plugin (I assume if you’re having the same problem I did!)
2. Create a new page, and call galleries into it like this:
[nggallery id=1 template=one]
[nggallery id=2 template=one]
[nggallery id=3 template=one]

3. Create a new subfolder in your theme folder called “nggallery”.
4. Create a blank php file in the subfolder called “gallery-one.php” (this is the template you called in step 2.
5. Read my explanations and then copy the code and see how it works for you.

(This first bit is copied from gallery.php in the NextGen plugin folder)

<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
<?php if (!empty ($gallery)) : ?>

Next we have to set our iterator (to find out where we are in the loop…not The Loop though).

<?php $i=1; ?>

Then let’s put our holder (with the ID of the gallery appended in the class) that will wrap each gallery.

<div class="holder<?php echo $gallery->ID; ?>">

And then our foreach statement. Here you can see I’ve added an IF statement that says, “if this is the first image, then show me the thumbnail linked to the lightbox slideshow…otherwise just give me a link (no image, but you need the a tag), and set its display to none”. After that is done, but before the FOREACH statement is finished, make sure and increment our iterator with $i++;

<?php foreach ($images as $image) : ?>
	<?php if ($i < 2) : ?>
		< a href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?> title="<?php echo $gallery->title ?>">
			<img src="<?php echo $image->thumbnailURL ?>" /></ a>

<?php else : ?> < a style="display:none" href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?>>link</ a> <?php endif; $i++; ?> <?php endforeach; ?>

Finally, close out your wrapping div, and close out the IF statement from the top:

</div>
<?php endif; ?>

Here’s the full code

<?php
/**
Template Page for the gallery overview

Follow variables are useable :

	$gallery     : Contain all about the gallery
	$images      : Contain all images, path, title
	$pagination  : Contain the pagination content

 You can check the content when you insert the tag <?php var_dump($variable) ?>
 If you would like to show the timestamp of the image ,you can use <?php echo $exif['created_timestamp'] ?>
**/
?>
<?php if (!defined ('ABSPATH')) die ('No direct access allowed'); ?>
<?php if (!empty ($gallery)) : ?>

<?php $i=1; ?>

<div class="gallery-holder gal<?php echo $gallery->ID; ?>">
<?php foreach ($images as $image) : ?>

	<?php if ($i < 2) : ?>
		<div style="display:none;">
			<img src="<?php echo $image->imageURL ?>" />
		</div>
		<a href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?> title="<?php echo $gallery->title ?>">
			<img src="<?php echo $image->thumbnailURL ?>" /></a>
	<?php else : ?>
		<a style="display:none" href="<?php echo $image->imageURL ?>" <?php echo $image->thumbcode ?>>link</a>
<?php endif; $i++; ?>

<?php endforeach; ?>
</div>

<?php endif;?>

Create a “featured” blog in WordPress (with no duplicates)

In your category view in WordPress, wouldn’t it be awesome to show a ‘featured’ blog per category? Here’s how (after many hours of work!).

Step 1: Setup
First, make sure you have another category called “featured”. So when you want to create a featured blog entry in, say your category of “travel”, then you would select “travel” and “featured” as categories.

Step 2: Category.php
Now, go into category.php. From here, insert a bit of code just above The Loop. Here’s the explanation: We are going to create a query that pulls all blogs with the category ‘feature’, and then narrow it down by the current category, and then limit the items to 1. The default with wordpress is to sort things chronologically, so the most recent article you categorized as ‘featured’ and in the “travel” category, will show up.

Next, we will create a variable called “$do_not_duplicate”. This will store the ID of the post it pulls for the feature. It’s important to store this ID, because then we’ll want to make sure and skip over that ID when we pull the rest of our blogs up, so there are no duplicates.

Ok, here’s the code:

  <?php $my_query = new WP_Query('category_name=featured&cat='.$cat.'&posts_per_page=1');
   while ($my_query->have_posts()) : $my_query->the_post();
	$do_not_duplicate = $post->ID; 
	echo 'featured: ', the_title();		
   endwhile; ?>

Step 3: Start the Loop (minus the already featured article)
Replace the standard Loop starter with the following code:

  <?php if (have_posts()) : while (have_posts()) : the_post(); 
        if($post->ID == $do_not_duplicate) continue; ?>
    /* rest of loop content as normal */
<?php endwhile; endif; ?>

What this does is use that $do_not_duplicate variable from above, and just passes over it when you pull the rest of your blog entries in.

Hope it works for you!

If you need more help, try checking out how to do multiple loops on wordpress.org