Recent Topics

Last 10 Posts

Started by on Nov 09, 2006 – Contents updated: Nov 09, 2006

Nov 09, 2006 07:06    

On my sidebar, I currently have the "Post by Post" method of archiving used. It looks great. However, this is only because I have about 7 posts thus far. I know that as I go on the list will be too long and confusing for people to navigate, not to mention it will make my blog page be too long. (I currently have only one blog entry per page--the way I'd like to keep it.)

What I would like to do, then, is put some code on there (uh, I hope this qualifies as "hack"--if not please let me know gently:) that will automatically display the last ten entries, that way I can put it above a monthly archieving system.

I am sure this is pretty simple, but, alas, I am clueless with all of this. Thank you ahead of time to anyone who can help me or point me in the right direction!

Nov 09, 2006 07:16

If I understand you correctly you want to have the last 10 posts listed and then a listing of monthly archives below that? (correct me if I'm wrong).

If so, and you're using 1.8+ then you just need to find a section of your skins _main.php that looks something like this :-

	<?php
		// -------------------------- ARCHIVES INCLUDED HERE -----------------------------
		// Call the Archives plugin:
		$Plugins->call_by_code( 'evo_Arch', array(	// Add parameters below:
			) );
		// -------------------------------- END OF ARCHIVES ----------------------------------
	?>

and change it to :-

	<?php
		// show last 10 posts
		// -------------------------- ARCHIVES INCLUDED HERE -----------------------------
		// Call the Archives plugin:
		$Plugins->call_by_code( 'evo_Arch', array(	// Add parameters below:
		'mode' => 'postbypost',
		'limit' => 10
			) );
		// -------------------------------- END OF ARCHIVES ----------------------------------
	?>
	<?php
		// show last 12 months
		// -------------------------- ARCHIVES INCLUDED HERE -----------------------------
		// Call the Archives plugin:
		$Plugins->call_by_code( 'evo_Arch', array(	// Add parameters below:
		'mode' => 'monthly',
		'limit' => 12
			) );
		// -------------------------------- END OF ARCHIVES ----------------------------------
	?>

¥

Nov 09, 2006 07:23

Awesome! Thank you very much!

Aug 10, 2007 09:33

In general this works really great and I´m using this now... but I´m wondering about some things:

1) Using this on blog1 the user cannot see, which posting comes from which other blog (2,3, ...). Would it be possible to diplay the blogname in e.g. in brackets behind the post title?

2) Would it be possible to display the post date e.g. in brackets behind the post title?

3) Would it be possible to show the last x posts with this code in such form, that e.g. on blog2 not the last x post only from blog2 are shown, but the last x post from blog1 (so the last x post from all blogs combined)?

Or do I have to include my own rss-feed for this...

Greetings,
Daniel

Aug 10, 2007 10:08

1 & 2 -> you'd need to hack the actual archives plugin to achieve this

3) You just need to change the code to something like this :

	$tempblog = $blog;
	$tempBlog = $Blog;
	$blog = 1;
	$Blog = $BlogCache->get_by_ID( 1 );
	// Call the Archives plugin:
        $Plugins->call_by_code( 'evo_Arch', array(    // Add parameters below:
        'mode' => 'postbypost',
        'limit' => 10
            ) ); 
	// -------------------------------- END OF ARCHIVES ----------------------------------
	$blog = $tempblog;
	$Blog = $tempBlog;

¥


Form is loading...

Social CMS software – This forum is powered by b2evolution CMS, a complete engine for your website.