Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • I used a variation on the idea that David posted above, to limit the display to only show the “titles”, “filed under stuff”, and the “comment info line”. This definitely improves the readability of a parent category, and maybe you can extend this for other php variables.

    Where David mentions the test for the lack of a post value ($p) to trigger the display of a title, I used the same type of test to not display $the_content variable. If you click on the title you get the whole post. Find this DIV in the index.php file . . .

    <div class=”storycontent”>
    <?php the_content(); ?>
    </div>

    replace it with this . . .

    <div class=”storycontent”>
    <?php if($p != ”) {the_content();} ?>
    </div>

    This will prevent the content of a post from displaying until you actually click on a post title to read it further. Its not exactly what you want, but its close.

    Ok – I found out how my previously posted hack breaks the app. While it works fine for the general viewing of your site, when you log in and go to the ‘Edit’ area, you can only see the one category ID you forced the $_GET[cat] value to. You can still see your drafts, and if you want to edit the published content you can do that by clicking on the ‘Edit This’ link in the post itself.

    Its not totally broken, but I will be working on this more to find a better way to do this.

    I solved this problem by adding a little snippet of code to the wp-blog-header.php file. There is a section that tests for command line variables that are passed using superglobals and other variables. I added a test after each pass of this for/next loop to see if the $_GET[cat] was null, and if so, set it to my preferred category. The block of code is below with the obvious hack between comments:


    $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name');

    for ($i=0; $i<count($wpvarstoreset); $i += 1) {
    $wpvar = $wpvarstoreset[$i];
    if (!isset($$wpvar)) {
    if (empty($_POST[$wpvar])) {
    if (empty($_GET[$wpvar]) && empty($path_info[$wpvar])) {
    $$wpvar = '';
    } elseif (!empty($_GET[$wpvar])) {
    $$wpvar = $_GET[$wpvar];
    } else {
    $$wpvar = $path_info[$wpvar];
    }
    } else {
    $$wpvar = $_POST[$wpvar];
    }
    }

    // add this test to set force the category value of your
    // preferred category when no category is selected - like when
    // you first visit the blog. This is the *cat_ID* field.
    // I used a value of 1 which is my General category.
    if ('' == $_GET[cat]) {
    $_GET[cat] = '1';
    }
    // end of inserted category force-feeding.

    }

    If there is a better way, I’m all ears. I haven’t found this to break anything – yet. I’m using version 1.2.

    Good Luck!

Viewing 3 replies - 1 through 3 (of 3 total)