Skip to Content.
Sympa Menu

lyceum-users - [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: Katz <singkit AT gmail.com>
  • To: lyceum-users AT lists.ibiblio.org
  • Subject: [Lyceum-users] A simple yet important modification to portal.php
  • Date: Sun, 28 Oct 2007 19:58:13 +0800

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?


--
CHILLMOZ
http://www.chillmoz.com


Archive powered by MHonArc 2.6.24.

Top of Page