• Resolved Iker

    (@iurte)


    Hello,

    I’m trying out some snippets from the documentation and although all the ones I’ve tried work for me, the ‘Snippet: Add Custom Listing Detail with Pre-defined Options’ didn’t work.

    /**
     * Add custom listing detail with pre-defined options in WPCasa
     */
    add_filter( 'wpsight_details', 'wpsight_details_condition' ); 
    
    function wpsight_details_condition( $details ) {
    	
    	$details['details_9'] = array(
    		'id'		=> 'details_9',
    		'label'		=> __( 'Condition', 'wpcasa' ),
    		'unit'		=> '',
    		'data'		=> array(
    			''		=> __( 'n/d', 'wpcasa' ),
    			'occupiable'	=> __( 'occupiable now', 'wpcasa' ),
    			'renovation'	=> __( 'some renovation required', 'wpcasa' )
    		),
    		'description'	=> '',
    		'query_var'	=> 'condition',
    		'data_compare'	=> '=',
    		'data_type'	=> '',
    		'dashboard'	=> false,
    		'position'	=> 90
    	);
    
    	return $details;
    
    }

    https://docs.wpcasa.com/article/snippet-add-custom-listing-detail-with-pre-defined-options/

    Can someone take a look at it?

    Thank you very much.

    • This topic was modified 4 years, 3 months ago by Iker.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author WPSight

    (@wpsight)

    Hello Iker,

    please also check your settings in WP-Admin > WPCasa > Settings > Listings and ensure that there is an additional field for your newly added custom details and name it accordingly.

    Let me know if there is anything else I can help with.

    All the best

    Thread Starter Iker

    (@iurte)

    Hello,

    The new listing details_9 apears in the wp-admin > wpcasa > settings > listings but it’s options still are none and the different measurements.

    Thanks.

    • This reply was modified 4 years, 3 months ago by Iker.
    Thread Starter Iker

    (@iurte)

    Sorry, I’ve got it, the options selector appears creating/editing the listing.

    Thank you very much.

    • This reply was modified 4 years, 3 months ago by Iker.
    Thread Starter Iker

    (@iurte)

    Hello,

    Is there a way to add a css style to each option when rendering? It would be very useful to be able to change, for example, the background color according to the selected option.

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Couldn’t make a snippet work’ is closed to new replies.