Feb 24 2009

Category in Page

I hacked into the page.php file, tested for the page I wanted to convert, and added the LOOP code from category.php file to run instead when it hit that page. I also had to reset the query when that occurred.

The pages are kept in the wp_post table and their post_type='page', That’s how I found the page number I wanted to check for.

 <?php if (is_page('738')) : /** Tech Page = post 738 **/ ?>
 <?php /** Change the query before the loop starts for the tech page **/
   /** category tech=4, techb=54 **/
   $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
   query_posts(array('category__in'=>array(4,54),'showposts'=>10, 'paged'=>$page));
   /** query_posts('category_name=techb&showposts=10'); **/ ?>

 <?php if (have_posts()) :  /** THE LOOP - CATEGORY **/ ?>
 ...

The one thing that’s not working is the “older/newer” links at the bottom. They come from the following code, and I’m not sure if I need to change it, or (more likely) change the modified query above to somehow take into consideration what page it’s on. Pagination? Anyone?  Found solution, and included above.

 <ul class="prevnext">
   <li class="newer"><?php previous_posts_link('Newer Posts'); ?></li>
   <li class="older"><?php next_posts_link('Older Posts');?></li>
 </ul>

Feb 18 2009

Filter Feed

Of course the error was a human one.
Copy-paste.

This post should now NOT show up in the feed.


Feb 18 2009

Accessing Module Configuration from Partials

I am using symfony and in need of having some module-level configuration set that can be used in both actions and partials. There doesn’t seem to be a mechanism to do this. The module.yml file is not included by partials. Likely for optimization reasons.

There is a bug report (#2878) that relates to this, but it appears to have been rejected and without explanation.

I could full-on add an additional configuration handler, but that seems overblown. Seems like there could minimally be a configuration setting to allow partials to access configuration from module.yml files.


Feb 17 2009

SQLitePersistentObjects

I was on another iPhone project that had several thousand simple data objects that I would need to keep and search through. SQLite again. I’ve seen Jeff Lamarche mention his open source project, SQLitePersistenObjects a few times, so I decided to give it a whirl.

You can get the code at it’s google source site. There’s not too much documentation available, but it seems simple enough (as any SQLite wrapper should aim to be). There is a ReadMe.txt with a brief introduction, and some sample code (which I haven’t yet looked at).

I went about including it a different way than the “drop the zip file in” method it suggests. My project is in SVN and I’m using Versions, so I just added an svn:extern statement and now have a subdirectory with the source in it.

In Xcode I created a new group, then edited it’s information to point to the subdirectory naturally, then added all the files in there to the group. Then right-click on frameworks, add existing framework, and dig through the /Developer/Platforms et al. until you get to the sqlite dynamic library to link against.

It built and compiled fine for me. Now off to put it through its paces.


Feb 16 2009

Markdown

I’ve got the PHP Markdown plugin installed, which is helpful in formatting code. I haven’t used it too much yet; it may interact with my otherwise preferred formatting options.

The general reference to the syntax of markdown can be found at daringfireball.


Feb 16 2009

Excluding Category from Main Page in WordPress

I’ve added the following custom code that I found on Zeo’s blog.  It gets added to the functions.php section of the theme being used for the blog.  Which obviously will require it to be updated each time I change the appearance of the blog.  But it’s simple.  I found a relatively complicated plugin which didn’t work and still required manual editing of the file.  If you’re aware of a functional plugin to do the same thing (preferably with a list of check boxes) I’d appreciate the pointer.

My goal here is to be able to maintain all my blog entries in one place, but allow me to write some technical entries that would otherwise bore my lay person reader (all three of them).

I also want to find a way to make a custom page to show all of the tech entries.  Off to search for that.


function exclude_category($query) {
  if ( $query->is_home || $query->is_home ) {
    $query->set('cat', '-54');
  }
return $query;
}
add_filter('pre_get_posts', 'exclude_category');