Crossposting Excerpts to LiveJournal

So I’ve been using the LJXP plug-in to crosspost my entries from this journal for a while now.  I liked that LJXP allowed me to choose certain categories to crosspost and others not to.  When I signed up with BlogHer, I needed all my content to only be on this one site, so I used LJXP to basically undo all those crossposts (pretty dang handy that it can do that).

For a while I’ve just been crossposting my “asides” and then hand coding a quick title and link on LJ that linked back to the entries here.  I was getting tired of doing that, so I wanted to be able to just crosspost an excerpt each time I updated.  Unfortunately the current version of LJXP doesn’t have an option for that.

Everything I looked at directed me to LivePress as the best possible solution, but I really didn’t want to have to install a different plugin, not to mention that I discovered with LJXP that what works for one person will often not work for another where these crossposting plugins are concerned.  And LJXP has worked for me.

So I started to try my hand at editing the code in LJXP to post an excerpt instead of the whole entry.  Nothing intuitive seemed to work there, like say some call to “the_excerpt” or “post_excerpt” or similar.  Instead I wound up editing the line:

$the_event .= apply_filters(‘the_content’, $post->post_content);

to say:

$the_event .= substr($post->post_content, 0, 350);

What I have done here is cheat.  Since I couldn’t get any of the appropriate WordPress variables to do what I wanted, I used a php function “substr” to return only the first 350 characters of the post.

I then used the LJXP’s custom header/footer feature to write a footer that started with an elipsis before the rest of my footer information, so that each 350 character cut ended with “…” and then instructions on how to read more.

It couldn’t crosspost all my old entries (error) but it’s managed to crosspost each new one I write no problem.  So with no warranties, no guarantees, no support, etc., if you’re using LJXP 2.0.6 (my plugin says it’s .6, the most recent download says .5, not sure what’s up there) you can feel free to give it a try for yourself to crosspost excerpts to LJ.  (Always save a copy of the original file before editing, yadda, yadda, use common-sense, plugins don’t always work, etc. etc.)

June 6, 2009 | 2:19 am | Comments Off
Posted in geekery | Thinking: , ,


Both comments and pings are currently closed.

Comments are closed.

 

Project Wonderful primarily features
advertising by creators and artists.

Click below to advertise
here with Project Wonderful.
1 | 2 | 3