• Resolved tanckom

    (@tanckom)


    So, got some more questions. (Between this plugin rocks!)

    I have a custom field in my function.php and it looks like this:
    add_filter( “adverts_form_load”, “my_adverts_form_load” );

        function my_adverts_form_load( $form ) {
            if( $form["name"] != "advert" ) {
                return $form;
            }
            $form["field"][] = array(            
                "name" => "number_test",
                "type" => "adverts_field_text",
                "order" => 19,
                "label" => "Number",
                "is_required" => true,
                "validator" => array( 
                    array( "name" => "is_required" ),
                )
            );
    return $form;
        }

    However I want to add, whatever the user puts in this field, on the search page like the location, title, image etc. is displayed. It would be also cool to have category displayed. And if possible, a feature like “Sort by – Price ; Category ; Number ” would be awesome ??

    I know this is a lot of custom scripting, but it may help other people in future to integrate your plugin into their websites ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    the category you can add on the list, by adding following code to wpadverts/templates/list-item.php file

    
    <?php $advert_category = get_the_terms( get_the_ID(), 'advert_category' ) ?>
    <?php foreach($advert_category as $c): ?> 
        <a href="<?php esc_attr_e( get_term_link( $c ) ) ?>"><?php echo join( " / ", advert_category_path( $c ) ) ?></a><br/>
    <?php endforeach; ?>
    

    As for sorting, this is something i have planned for one of next WPAdverts updates, but right now i cannot tell when it will be ready.

    Thread Starter tanckom

    (@tanckom)

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add custom field in ads display’ is closed to new replies.