Skip to Content.
Sympa Menu

lyceum-users - Re: [Lyceum-users] A simple yet important modification to portal.php

lyceum-users AT lists.ibiblio.org

Subject: Lyceum-users mailing list

List archive

Chronological Thread  
  • From: John Joseph Bachir <jjb AT ibiblio.org>
  • To: lyceum-users AT lists.ibiblio.org
  • Subject: Re: [Lyceum-users] A simple yet important modification to portal.php
  • Date: Mon, 26 Nov 2007 00:55:58 -0500 (EST)

Thanks Katz. As Adam mentioned, the current version of Lyceum allows you to deactivate the welcome post entirely. Also, I believe the current portal.php does much nicer stripping/formatting of the newest posts list. Let us know what you think.

On Sun, 28 Oct 2007, Katz wrote:

Hi. I am Katherine/Katz/sikatzonline/chillmoz and planetjazz.org developer.

I made this simple hack to portal.php

If you have lyceum 1.0

You should see this:

<?php
define('WP_USE_THEMES', true);
$blog='NULL';
$blogdata='NULL';
$optiondomain = 'system';
$_REQUEST['b']='system';

require('private.php');
require(CONFIGPATH . 'wp-config.php');

get_currentuserinfo();

$site_title = get_settings('site_title');

$wpdb->query("
CREATE TEMPORARY TABLE bloginfo
SELECT $wpdb->blogs.id, $wpdb->blogs.slug, option_value as blogname,
status
FROM $wpdb->blogs
INNER JOIN $wpdb->options ON ($wpdb->blogs.id = $wpdb->options.blog)
INNER JOIN $wpdb->posts
INNER JOIN $wpdb->post2cat ON (post_id = $wpdb->posts.ID)
INNER JOIN $wpdb->categories ON (category_id = cat_ID AND $wpdb->
categories.blog = $wpdb->options.blog)
WHERE
status = 'active' AND
option_name = 'blogname' AND
post_title != 'Hello world!' AND
post_title != 'About'
ORDER BY post_date_gmt DESC
");

$blogs = $wpdb->get_results("SELECT DISTINCT(id), slug, blogname, status
FROM bloginfo ORDER BY blogname ASC");

$posts = get_recent_posts(8);


if ( isset($_SESSION['slug_error']) ) {
$slug_error = $_SESSION['slug_error'];
unset($_SESSION['slug_error']);

Before ?>
Insert:

// TRUNCATE POSTS AND STRIP TAGS FUNCTION
function postsTruncate($string, $limit, $break=".", $pad="...") {
if(strlen($string) <= $limit) return $string;
if(false !== ($breakpoint = strpos($string, $break, $limit))) {
if($breakpoint < strlen($string) - 1) { $string = substr($string, 0,
$breakpoint) . $pad; } }
return strip_tags($string); }
//
===========================================================================

And change:

<blockquote>
<?php
echo strip_tags($p->post_content) . '...'." <a href=\"$p->guid\">read
more</a>";
?>
</blockquote>

to:

<?php
echo postsTruncate($p->post_content,200) . '...'." <a
href=\"$p->guid\">read more</a>";
?>

Not a very clean code but anyone can feel free to use it.

Just one big question:

How do I exclude "Hello World" posts from being displayed for the recent
posts?




--
John Bachir
http://lyceum.ibiblio.org/
http://blog.johnjosephbachir.org/
aim/yim/msn/jabber.org/gtalk: johnjosephbachir
713-494-2704
irc://irc.freenode.net/lyceum



  • Re: [Lyceum-users] A simple yet important modification to portal.php, John Joseph Bachir, 11/26/2007

Archive powered by MHonArc 2.6.24.

Top of Page