All posts by jeffrey hannan

Undefeated

The passage of Proposition 8 in California will rewrite the state Constitution with a bitter pen of fear and loathing. What it will not do is change what is true.1) Arvin and I were legally married on Oct 25. Period.

2) The law cannot suppress forever what the heart knows is true.

Prop 8 will create a constitutional amendment declaring that marriage in California is between a man and woman only. We have already proven that to be false: our unification ceremony in Palm Springs was entirely legal. Arvin and I are legally married. Can the will of a certain sect of people nullify something that already exists? (The infinite powers of the Vatican notwithstanding.)

If necessary, I say let that 50-odd% of the people keep their term marriage. Do I really want to take part in an institution that has a 50% failure rate and comes with it the baggage of constantly fearing for its permanence because of invisible outside threats?Those 50+% can keep their sanctimony. I, on the other hand, will preserve the true sanctity of my commitment.

Ya voté!…

I voted

…Did you?

In the garage of a small condo building up the street Arvin and I cast our votes for 2008. The fatigue from the constant bombardment that typifies the election season is only exceeded by the anticipation of (or anxiety over) the outcomes.

Our love of direct democracy in California seems to grow with every election. This year there were 34 ballot measures to vote on, along with the scant 8 political offices up for grabs, including the most coveted one of all: the one to replace W. (Why on earth would anyone want to clean up that mess?)

San Francisco snapshot:

  • State voter guide: 143 pages
  • State supplement (Prop 1A): 15 pages
  • # of state ballot initiatives: 12
  • SF voter guide: 272 pages
  • # of local ballot initiatives: 22

Preparation is everything

We were in line for about 20 minutes waiting for one of seven voting stations. When we arrived there was a guy at the second station in from the door. When we left, after registering our votes, he was still there, his head down, his back to the room. We could only assume he was reading the ballot for the very first time and making his decisions on the fly.

I don’t blame the guy for coming to the polls and being overwhelmed. Thirty-four measures is a lot. I’ll cut him some slack because (1) he was voting, and (2) it takes a lot of time to pore through 415 pages of voter information. But he loses significant points because (1) he didn’t prepare like the rest of us and (2) he sucked up enough time that at least four other people could have voted.

Can’t get enough?

In case 24 hour news coverage isn’t enough (I use the term ‘news’ cautiously and, in some cases, with righteous indignation), there are some election day live blogs on HuffingtonPost.com that you can add to your reading list of…oh, about 116,000,000 million online references to the 2008 elections (google it: “2008 elections united states”).

Now the long night of results…


Custom Searching code

accepted

Here is what worked for me.

Preethis answer almost got there, but no data was getting set. I needed to find a way of accessing the data in the array, and I used implode to do it.

So here is my final code that enabled me to create a search form that loops and displays categories, allows the user to do a keyword search via any number of categories, and display results IF the keyword exists in any of the categories selected:

I created a searchform.php file in my theme file and included the following HTML:

<form id="searchform" method="get" action="<?php bloginfo('url'); ?>">
<fieldset>

    <input type="text" name="s" value="" placeholder="Search..."></input>
    <button type="submit">Search</button>
    <div class="clear"></div>
    <div class="search_category_section">
    <?php
        $args = array('parent' => 0);
        $categories = get_categories($args);

        echo '<div class="search_category_section">';

        foreach ($categories as $category) {

        $thecatid = $category->cat_ID;
            echo '<div class="categorylist"><div class="parent_category_list_item"><input id="', $thecatid, '" type="checkbox" name="category_name[]" value="', $category->slug, '"><label for="', $thecatid, '">', $category->name, '</label></input></div>';
            $childcats=get_categories(array('parent' => $thecatid));
                foreach($childcats as $c) {
                echo '<div class="child_category_list_item"><input id="', $c->cat_ID, '" type="checkbox" name="category_name[]" value="', $c->slug, '"><label for="', $c->cat_ID, '">', $c->name, '</label></input></div>';
            }
        echo '</div>';
        }
    ?>
        </div>
</fieldset>

and then, my functions.php has the following code:

<?php
    function advanced_search_query($query) {
        if($query->is_search()) {
            $get_the_category_name = $_GET['category_name'];
            if (isset($get_the_category_name) && is_array($get_the_category_name)) {        
            $catnames = implode(",",$get_the_category_name);
            $query->set('category_name', $catnames);
            return $query;
            }
        }
    }
    add_action('pre_get_posts', 'advanced_search_query');
    ?>

if you do:

var_dump($get_the_category_name);

You’ll get:

array(2) { [0]=> string(22) "category-a" [1]=> string(25) "category-b" } 

Run implode() on that

string(48) "human-element-analysis,latent-defects-check-list" 

Stick that string in a variable, set it in query as category_name, win.