Support » Plugins » Display front page posts by zip code

  • MTV


    I’m looking for a plugin that able to show a specific category to assigned destination. For instant, I set category A to California , category B to New York, etc… visitors. So if a visitor from California, the posts from category A will be displayed on the front page instead of showing latest posts

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Michael,

    It’s a useful plugin but it’s not what I was looking for. Let’s say, I want set zipcode for category A. So when visitor enters his/her zipcode, the latest posts from that category A will show on the front page.

    You could do something like this. Give each post a tag that includes the zip code. then run a search for them. you’ll want to clean the input before submitting so a process page would be nice. It’s a simple example.

    <input type="text" name="zip" value="" />
    <button type="submit">Submit Zip</button>
    <br />
     global $post;
     $zip = $_GET['zip'];
     $zip = ereg_replace("[^0-9]", "", $zip);
     $myposts = get_posts('numberposts=3&tag='.$zip);
     foreach($myposts as $post) :
     <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; echo $zip; ?>

    this is very limiting though. If I type in my zip code, and only postts that show are in that zip code, unless you have millions of articles, the odds of me finding anything is slim. a radius effect might be handier:

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display front page posts by zip code’ is closed to new replies.