Results 1 to 5 of 5

Thread: Creating Custom Fields for Wanted/Offering

  1. #1
    Thread Starter
    Junior Member
    Not a Verified Customer
    Il Gatto's Avatar
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    0
    Thanked 2 Times in 1 Post

    Creating Custom Fields for Wanted/Offering

    Ok, I need some help at this

    I want to achieve three things

    • 1) when users post a new ad, they need to specify if their ad is "for sell" or "wanted" - I don't want to use categories for this, I want to do it with a custom field so users are forced to input the correct value;[/*:m:22osp41u]
    • 2) the ad type shows in each single post[/*:m:22osp41u]
    • 3) on the main index page, the ad type shows in the columns, next to price or location, so anyone can spot if an ad is wanted or for sale[/*:m:22osp41u]


    I created a new custom field

    Code:
    <select id="type">
                        <option classs="" value="for sale"><?php _e('I want to sell something', 'cp') ?></option>
                        <option class="" value="wanted"><?php _e('I am looking for somethingt', 'cp') ?></option>
    </select>
    for this task I followed instructions found at http://www.erichamby.com/2009/12/16/cla ... nt-page-1/ and it works

    however I still have to solve my point 2) and 3)

    if I add this line in single.php:

    Code:
    <?php _e('Type'); ?>: <?php echo get_post_meta($post->ID, "type", true); ?>
    in the single post view it only shows a text "Type:" of course... I want to be able to add the text "For sale" or "Wanted" -
    how do I specify this?

    then, in the main index page, how do I show the same string of text ("for sale" or "Wanted") in a column?

    thank you & happy new year

  2. #2
    Thread Starter
    Junior Member
    Not a Verified Customer
    Il Gatto's Avatar
    Join Date
    Dec 2009
    Posts
    47
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Creating Custom Fields for Wanted/Offering

    perhaps an alternative way to do this is with categories...

    just create a main category "for sale" and a main category "wanted" ?
    then replicate a tree for sale and wanted, but I find this a bit confusing from a user point of view

    I want to make sure that users post their ad in the correct category to avoid users mistakes (i.e. users mistaking a "wanted" classified for a "for sale" classified and viceversa)

    which do you think is the best option to separate the two things very clearly? - and maybe generate two separate feeds too... which might come handy...

  3. #3
    Member
    Not a Verified Customer
    lappyhappy's Avatar
    Join Date
    Jan 2010
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Custom Fields for Wanted/Offering

    I like your idea and I also would like to do a similar thing. If anyone can help it would be greatly appreciated.

  4. #4
    Junior Member
    Not a Verified Customer
    pooya3d's Avatar
    Join Date
    Oct 2009
    Posts
    43
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating Custom Fields for Wanted/Offering

    hi,
    did you manged to solve the problem 2 and 3 ? please let us know the solution as well.
    thanks

  5. #5
    pepsi's Avatar
    Join Date
    Mar 2009
    Location
    New Zealand
    Posts
    14,883
    Thanks
    91
    Thanked 804 Times in 718 Posts

    Re: Creating Custom Fields for Wanted/Offering

    One of the many great new features of CP 3.0 is that you can create custom ad forms, which also allows you to create mandatory fields in the form. The only aspect of your original post that doesn't come up is the column appearing on the home page, but I'm sure with some tweaking you could achieve this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)