WordPress.org

Forums

HELP! Show-one-category-on-front-page hack (7 posts)

  1. carthik
    Member
    Posted 11 years ago #

    it's my-hacks.php
    Is that the reason why?, I wonder.

  2. danes75
    Member
    Posted 11 years ago #

    naw... just accidentally left out the - :-D
    everything else in the my-hacks.php file works.

    <?php
    if ('/' == $_SERVER['REQUEST_URI'] || '/index.php' == $_SERVER['REQUEST_URI'])
    $cat = 1;
    // Switcher
    require_once('wp-style-switcher.php');
    wp_style_cookie();
    // Mood
    require_once('wp-mood/wp-mood.inc');
    // people popup
    function peopleDefine($text) {
    global $wpdb;
    $names = $wpdb->get_results("SELECT people_ID, people_name, people_bio FROM wp_people");
    ?>
    <script language="JavaScript" type="text/javascript">
    <!--//
    function peoplePop(id){
    peopleURL = 'wp-people-popup.php?person=' + id;
    window.open (peopleURL, 'peopleWin', 'toolbar=no,location=no,menubar=no,status=no,scrollbars=yes,status=no,width=350,height=350');
    }
    function myVoid(){
    null;
    }
    //-->
    </script>
    <?php

    foreach ($names as $names) {
    $thisID = $names->people_ID;
    $searchArray = array('\'','\"');
    $replaceArray = array('&lsquo;','&quot;');
    $real_name = $names->people_name;
    $text = preg_replace("#$real_name(?!</(ac|sp))#",
    "$real_name", $text, 1);
    $text = preg_replace("#$real_name(?!</(ac|sp))#",
    "<span class=\"caps\"'>$real_name</span>", $text);
    }
    return $text;
    }
    add_filter('the_content', 'peopleDefine');
    ?>

  3. carthik
    Member
    Posted 11 years ago #

    Try
    http://wiki.wordpress.org/index.php/ShowOneCategory
    this does not use my-hacks.php at all, so might be useful.

  4. danes75
    Member
    Posted 11 years ago #

    sweet!!! thanks a TON!!!

  5. danes75
    Member
    Posted 11 years ago #

    hmm.... dammit. while that does prevent any other than the specified category to show on the main page... it also keeps you from EVER getting to them. WTF?????

  6. nolageek
    Member
    Posted 11 years ago #

    Where are y'all finding
    '/* Don't remove these lines. */
    $blog = 1;
    $cat = 1;'
    at? My first three lines look like:
    <?php
    /* Don't remove this line. */
    require('./wp-blog-header.php');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head profile="http://gmpg.org/xfn/1">
    <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>

  7. Kelso
    Member
    Posted 11 years ago #

    Nevermind, I got it to work.
    I got rid of the line:
    if ('/' == $_SERVER['REQUEST_URI'] || '/index.php' == $_SERVER['REQUEST_URI'])
    ;)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.