• Resolved vanessacolletcolomb

    (@vanessacolletcolomb)


    Hello,
    I have created a personal field in the details section but it is not displayed on the car ad.
    I am using the OceanWP theme.
    Can you help me?

    Code set up with a Code Snippets plugin

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author autolistings

    (@autolistings)

    Hi,

    To display your custom field on the car ad, you also need to use this hook: ‘auto_listings_details_array’. It’s used in the file ‘auto-listings\templates\single-listing\tabs\details.php’

    Thread Starter vanessacolletcolomb

    (@vanessacolletcolomb)

    Hello,
    I have created the following code:

    add_filter( 'auto_listings_metabox_details', function ( $fields ) {
        $prefix = '_al_listing_';
        $fields[3] = array(
            'name' => __( 'Mise en circulation', 'auto-listings' ),
            'desc' => __( 'A custom description', 'auto-listings' ),
            'id' => $prefix . 'mise_circulation',
            'type' => 'text',
        );
        return $fields;
    } );

    And I put it in the file you gave me but it doesn’t work, I don’t have any fields displayed on the car page.
    code:

    $details_array = array(
    	__( 'Vehicle', 'auto-listings' )               => auto_listings_vehicle(),
    	__( 'Price', 'auto-listings' )                 => auto_listings_price(),
    	__( 'Mise en circulation', 'auto-listings' )   => auto_listings_mise_circulation(),
    	auto_listings_miles_kms_label()                => auto_listings_odometer(),
    	__( 'Color', 'auto-listings' )                 => auto_listings_meta( 'color' ),
    	__( 'Registration', 'auto-listings' )          => auto_listings_meta( 'registration' ),
    	__( 'Transmission', 'auto-listings' )          => auto_listings_transmission(),
    	__( 'Body', 'auto-listings' )                  => auto_listings_body_type(),
    	__( 'Drive Type', 'auto-listings' )            => auto_listings_drive_type(),
    	__( 'Engine', 'auto-listings' )                => auto_listings_engine(),
    	__( 'Fuel Economy Combined', 'auto-listings' ) => auto_listings_fuel_economy(),
    );
    Plugin Author autolistings

    (@autolistings)

    Hi,

    All the code for customizing Auto Listings needs to be in your functions.php. The template I gave you before is just to let you know how this code is used. Please try this code (put this into functions.php not auto-listings\templates\single-listing\tabs\details.php):

    
    add_filter( 'auto_listings_details_array', function( $fields ) {
    	$fields[ 'Mise en circulation' ] = auto_listings_meta( 'mise_circulation' );
    	return $fields;
    } );
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘custom fields’ is closed to new replies.