Ning Developer Network

Right now, I know that you can either view your blog on your front page the following ways: title only, or first paragraph or full blog.

What I am looking to do is view the title of my blog and the first one or two sentences of the blog with a 'continue' option after it. Right now, it's showing 8 lines of copy and then continue.

I attached a snapshot of FOHBOH's blogs. I know it's possible, but how!!! :) THANKS!

Tags: blog, blogging, front, help, link, ning, page, stories, view

Share

Attachments:

Replies to This Discussion

Paste this code into your Analytics textbox which you'll find by clicking Manage and then clicking the Analytics icon:


<script type="text/javascript">

x$(document).ready(function() {

// Blog content limiter (Change 40 to how many characters to show):
if (x$(".xg_widget_profiles_blog_show").length == 0) {
var pb = x$("div.postbody").html();
pb = pb.replace(/^\s+|\s+$/g, ''); // TRIM
pb = pb.substring(0, 40) + "...";
x$("div.postbody").html(pb);
}

});
</script>


Let me know if this works for you.

Best Wishes,

"TJ"
Thanks, that worked for me.
Aha! That is FABULOUS! Greatly appreciated. Thanks :)
You're both welcome. Always glad to help! :)
Hi! It's me again. I have one more question that I think you'll be able to answer. See on the attachment (Fohboh), they have more after the first couple of lines of the blog so you can click to read more of the story...how would I add a 'more' button or a 'continue' button to the end of my blog?

Sorry to bug you again!
Thanks
Okay, I have a better mod for you. BUT... it's not perfect. It will only show 'continue' if the blog originally said 'continue' on the Main page. Sometimes, blog posts are very short and the snippet that shows on the Main page contains the entire post, so there's no 'continue' link. I could make a 'continue link, but that would take me a little more time! (If you really want it, even on the short blog posts, let me know and I'll quote you a small fee for doing it.)

Anyway, replace the code I gave you with this and let me know how it works for you!


<script type="text/javascript">

x$(document).ready(function() {

// Blog content limiter (Change 40 to how many characters to show):
if (x$(".xg_widget_profiles_blog_show").length == 0) {
x$("div.postbody").each( function(i) {
var pb = this.innerHTML;
var linkptr = pb.indexOf("<A"); // In View Source, looks a but really A!
var link = "";
if (linkptr > -1) link = pb.substring(linkptr);
pb = pb.replace(/^\s+|\s+$/g, ''); // TRIM
pb = pb.substring(0, 40) + "... " + link;
this.innerHTML = pb;
});
}

});
</script>
It worked! PERFECT!! Thanks so much!
You're Welcome, always glad to help! :)
Is there anyway that instead of going to the 40 or whatever character limit, is there anyway to have the script show the blog post up until the point you add a tag like < main_break > to your blogs HTML or something along those lines?

RSS

© 2009   Created by Ning Developer Admin

Badges  |  Report an Issue  |  Privacy  |  Terms of Service