Filters in functions.php causing white screen

Easy Property Listings WordPress Real Estate Plugin Forums Priority Support Filters in functions.php causing white screen

Viewing 9 posts - 1 through 9 (of 9 total)

These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.

  • Author
    Posts
  • #10333
    Gail Delaney
    Spectator

    I am trying to add new property filters to the functions.php file but it causes the edit property screen to be blank.

    Please can you tell me the error? I know the code is OK as it works when directly pasted into the plugins functions.php file.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #10349
    Merv Barrett
    Keymaster

    Your code is incorrect, where did you get the example from (could be a bad example).

    Format should be like so:

    function my_epl_listing_load_meta_property_category() {
    	$defaults = array(
    		'Detached'		=>	__('Detached House', 'epl'),
    		'Semi-detached'		=>	__('Semi-Detached House', 'epl'),
    		// fields truncated for forum
    	);
    	return $defaults;
    }
    add_filters( 'epl_listing_meta_property_category', 'my_epl_listing_load_meta_property_category' );
    • This reply was modified 8 years, 11 months ago by Merv Barrett. Reason: add_filter
    #10351
    Merv Barrett
    Keymaster

    Similar syntax to your my_epl_opts_rent_period_filter() in the file you supplied.

    The reason for the error is that there already is a function called epl_listing_load_meta_property_category() adding another causes the error. Also you need to use add_filter. (i updated the example above)

    #10369
    Gail Delaney
    Spectator

    Here is the code now, it still errors with this – thanks in advance:

    <?php

    add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ );
    function theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’,
    get_stylesheet_directory_uri() . ‘/style.css’,
    array(‘parent-style’)
    );
    }

    function my_epl_disable_feature_links() {
    return false;
    }
    add_filter( ‘epl_features_taxonomy_link_filter’ , ‘my_epl_disable_feature_links’ );

    // Easy Property Listings Rental Options Filter
    function my_epl_opts_rent_period_filter() {
    $opts_rent_period = array(
    ‘day’ => __(‘Day’, ‘epl’),
    ‘week’ => __(‘Week’, ‘epl’),
    ‘month’ => __(‘Month’, ‘epl’),
    ‘year’ => __(‘Year’, ‘epl’),
    );
    return $opts_rent_period;
    }
    add_filter( ‘epl_opts_rent_period_filter’ , ‘my_epl_opts_rent_period_filter’ );

    /**
    * Custom Meta: House Categories
    *
    * @since 1.1
    * @return all the categories in array
    */

    function my_epl_listing_load_meta_property_category() {
    $defaults = array(
    ‘Detached’ => __(‘Detached House’, ‘epl’),
    ‘Semi-detached’ => __(‘Semi-Detached House’, ‘epl’),
    ‘Terraced’ => __(‘Terraced House’, ‘epl’),
    ‘EndTerraced’ => __(‘End Terraced House’, ‘epl’),
    ‘Weavers’ => __(‘Weavers Cottage’, ‘epl’),
    ‘Mews’ => __(‘Mews House’, ‘epl’),
    ‘TownHouse’ => __(‘Townhouse’, ‘epl’),
    ‘Bungalow’ => __(‘Bungalow’, ‘epl’),
    ‘Apartment’ => __(‘Apartment’, ‘epl’),
    ‘Flat’ => __(‘Flat’, ‘epl’),
    ‘Bedsit’ => __(‘Bedsit’, ‘epl’),
    ‘Land’ => __(‘Plot of land’, ‘epl’),
    ‘Farm’ => __(‘Farm’, ‘epl’),
    ‘CommSale’ => __(‘Commercial Property – For Sale’, ‘epl’),
    ‘CommRent’ => __(‘Commercial Property – To Rent’, ‘epl’),
    ‘Investment’ => __(‘Investment Property’, ‘epl’),
    ‘Garage’ => __(‘Garage’, ‘epl’),
    ‘Other’ => __(‘Other’, ‘epl’),
    );
    return $defaults;
    }
    add_filters( ‘epl_listing_meta_property_category’, ‘my_epl_listing_load_meta_property_category’ );

    #10371
    Merv Barrett
    Keymaster

    They work. Just be careful not to add an additional <?php in the file.

    Attachments:
    You must be logged in to view attached files.
    #10373
    Gail Delaney
    Spectator

    Thank you 🙂

    #10374
    Gail Delaney
    Spectator

    Ah, mine said add_filters( ‘epl_listing_meta_property_category’, ‘my_epl_listing_load_meta_property_category’ ); not add_filter( ‘epl_listing_meta_property_category’, ‘my_epl_listing_load_meta_property_category’ );

    #10378
    Merv Barrett
    Keymaster

    Ah ha, even the smallest comma or missing ; can cause issues. Other themes like iThemes Builder produce an error message instead of a white screen to let you know what caused the error.

    Glad you sorted it out 🙂

    #10379
    Merv Barrett
    Keymaster

    Also if you get a chance please leave a review of Easy Property Listings plugin on WordPress.org

These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Priority Support’ is closed to new topics and replies.