Remove the excerpt from OnSwipe

This is a photo blog.  I know.  So if you are interested in using the new official WordPress iPad plugin, OnSwipe, for a photoblog and don’t like text on photos… read on.  However if you don’t care about customizing a ‘theme’ for iPad, then this post may not be for you.

get the wordpress excerpt out

A bit of background first.  Our photoblog here at the Yakima Herald-Republic is currently using an iPad plugin for WordPress that improves the user experience.  However, it’s in a beta-type environment and does not have too many ways to modify the look and feel.   I wrote about testing it out here a couple weeks back when OnSwipe was deployed on yakimaheraldphotos.com and on over 18 million wordpress.com Web sites.

After tinkering with the settings on the YH-R photoblog site, I found that it did not include a method of removing the WordPress loop “excerpt” from the pages.

To be blunt, I was irritated because I prefer having as little text (if any at all) on images.  Especially the auto-generated type.  If you are familiar with WordPress themes modification, then you know that removing the excerpt command in the page/home/archive/etc… php theme document to get rid of the offending text.

However, this ‘theme’ ( by Armando Sosa) for iPads is a plugin.  It’s structured a bit different than a typical WP theme to do a particular job, and it does it incredibly well.  The only thing, because it’s a plugin, it’s not that easy to modify or customize.

So here’s the skinny on getting rid of that pesky excerpt bar in the OnSwipe plugin. It will require a bit of code hunting but thankfully you only will need to poke into two of the plugin documents and alter a few bits of code.  Once you are done, you will have a photoblog with headlines only.

Removing excerpts from OnSwipe!

Open up the OnSwipe plugin folder on your local machine.  Make a copy of the style.css and theme.php documents to your desktop (they are in the onswipe/themes/warp folder)

Open up both of the documents and follow these instructions.

———-

#1 — themes/warp/theme.php

In the excerpt length area, set the length to “return 0;”
(I considered just shortening the length and having a single line but I simply wanted it gone.)

/**
* excerpt length
*
* @return void
* @author Armando Sosa
*/
function excerptLength(){
return 0;
}

#2 — themes/warp/theme.php

At the bottom of the page add this filter to remove the […] from the excerpt field. (This has been edited to reflect changes since this post was published.)

function trim_excerpt($text) {
return rtrim($text,’[...]‘);
}
add_filter(‘get_the_excerpt’, ‘trim_excerpt’);

#3 — themes/warp/style.css

Change padding to “1px;” to put a simple line at the bottom of the photo (or you could put 0 if you don’t like that)

.entries-archive .archive-entries-container .entry.with-image .entry-excerpt {
-webkit-box-sizing: border-box;
width: 100%;
line-height: 140%;
position: absolute;
bottom: 0;
left: 0;
padding: 1px;
background: rgba(0, 0, 0, 0.5);
color: #f2f2f2;
color: rgba(255, 255, 255, 0.9);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.6); }

———

Then save the documents and upload (ftp) them to the onswipe/themes/warp folder on your web site.  Preview the changes on your iPad to confirm you didn’t miss something.  If something goes awry, then you have the original theme.php and style.css documents in the onswipe folder on your desktop to return the plugin to its original state.

That’s about it.  Good luck!

-TJ Mullinax

——–

ADDENDUM (May 16, 2011)

The excerpt trim function needed some additional information thanks to some fellow onswipe theming commenters.

Just in case wordpress removes the function code above, here’s a screengrab of what must be done to the onswipe theme.php document.  The example highlighted in yellow is how the bottom of the theme.php should look to remove the excerpt.  Thanks all!

2 Comments

  1. Shawn

    I am confused by step #2. Can you make that more clear? You say add this filter, what do you mean?

    Thanks in advance.

    • TJ Mullinax

      I’m not too sure what happened, but the “filter” code was wiped out. I wonder if it had anything to do with switching between html and visual modes of wordpress. Thanks for noticing, and let me know how it works out!
      -TJ