Forums | Another Question

You must be logged in to post Login Register

Search Forums:


 






Another Question

UserPost

6:16 pm
October 23, 2007


mxrider108

Member

posts 13

Hey, I have another question :) I would like to have a link on the sidebar that takes the user to the latest comic's permalink instead of having a list of several recent comics (as the default theme has). Is there any way to do this with the recent_comics or latest_comic function of the stripshow plugin? I would need the text inside the anchor tag to be static (so it would always say "Latest Comic" instead of showing the title of the comic). Thanks for the help.

P.S. I tried using a modified version of your latest_comic function, but the link never shows up because it thinks the latest comic is already showing on the index page (which it no longer is).

4:45 am
October 24, 2007


Brad

Admin

posts 186

You can pass an argument to recent_comics() to show as many or as few comics as you want. For instance, recent_comics(1) will show the latest comic… however, that will show the comic's title.

I take it you've got it set up so the most recent comic is not necessarily on the index page? I didn't anticipate this arrangement…. if people are doing it, though, I should come up with something to accommodate that.

What's your URL? I'd like to see the way you're setting it up.

1:19 pm
October 24, 2007


mxrider108

Member

posts 13

Yeah I'm trying to make it so the index page is only blog related posts, then you have a link in the header nav bar (which I havent built yet since I'm just using your default theme for now) that says "Comic" and links to the most recent comic (Like it is on Penny Arcade, for example). The primary reason for this is that my comics are extremely large and would require way too much scrolling to reach the blog posts. My site's current URL is http://synodev.com, but I'm going to change my domain name once I get the webcomic up and running. Again, I really appreciate you making and distributing the stripShow theme/plugin as well as helping me in my pursuit for the perfect webcomic cms.

1:53 pm
October 24, 2007


Brad

Admin

posts 186

Try this, mx: First, upgrade to stripShow 1.5 (I don't think this will work with RC1).

Then, in stripshow.php, replace the last_comic() function with this:

function last_comic($linktext="Last Comic",$absolute=FALSE,$always=FALSE) {
global $wpdb,$post;
$temp = $GLOBALS['wp_query'];
$results = query_posts('showposts=1&order=DESC&cat='.strip_category());
$last = $results[0];
if (($last->ID != $post->ID && is_comic($post)) || $always) echo '<a href="',($absolute) ? get_permalink($last_id) : get_bloginfo('url'),'">'.$linktext.'</a>';
$GLOBALS['wp_query'] = $temp;
}

Then, in your sidebar, where you have
last_comic('Latest Comic');

replace that with:
last_comic('Latest Comic',$absolute=TRUE,$always=TRUE);

This way, with these two extra parameters, we tell the last_comic() function to point to the permalink of the last comic, not to the index, and tell it to always show, even if it IS at the last comic (which the index page will think it is).

And I've just made my very first edit towards 1.5.1. :)

NOTE: I updated this post after I discovered the need to add that second parameter.

2:29 pm
October 24, 2007


mxrider108

Member

posts 13

I'm about to try this, but I want to double check: If I replace the last_comic() function with that will I still be able to have navigation arrows above my comic strips? If not, I should probably name it something else and keep the original last_comic() function. I'll write back or edit this post once I try it out. Thanks again.

EDIT: After actually READING your code, I realize it shouldn't effect the arrows since the default parameters for the function are false…looks like you are already two steps ahead of me.

EDIT 2: OK, I tried making the changes you wrote up and it is working beautifully, with one exception. If I click the link at the index page it sends me to the most recent comic, but if I click it at, say, the About page, it does not. Instead it becomes a link to the very same about page I am currently viewing…which seems odd. The section of the sidebar for the Latest Comics still work when I am viewing the about page, but the Latest Comic link does not.

3:09 pm
October 24, 2007


Brad

Admin

posts 186

Ah. I hadn't tested on pages, only posts. My bad. I see the same behavior you are. I'll have to find out why it does that.

3:13 pm
October 24, 2007


Brad

Admin

posts 186

Ah! Oops! It's sloppy coding. In the last_comic() function, where I put $last_id, it should be $last->ID. Not sure how I messed that up (or, indeed, how it worked on other pages). Sorry about that.

3:41 pm
October 24, 2007


mxrider108

Member

posts 13

Working great- Love it!



  • Subscribe to Feed

    Enter your email address:

    Delivered by FeedBurner

  • Meta

  • Donate

    While I don't maintain stripShow for a living, I wouldn't say no to a little donation, if you think the plugin is worth it...

  • Advertisements