The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Display front page posts by zip code (4 posts)

  1. MTV
    Posted 6 years ago #

    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

  2. MichaelH
    Posted 6 years ago #

  3. MTV
    Posted 6 years ago #

    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.

  4. tugbucket
    Posted 6 years ago #

    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:


Topic Closed

This topic has been closed to new replies.

About this Topic