Easy Property Listings WordPress Real Estate Plugin › Forums › Priority Support › Filters in functions.php causing white screen
Tagged: custom filter, filter
- This topic has 8 replies, 2 voices, and was last updated 8 years, 11 months ago by Merv Barrett.
These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.
-
AuthorPosts
-
May 12, 2015 at 5:46 pm #10333Gail DelaneySpectator
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.May 12, 2015 at 7:16 pm #10349Merv BarrettKeymasterYour 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
May 12, 2015 at 7:18 pm #10351Merv BarrettKeymasterSimilar 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)
May 12, 2015 at 10:02 pm #10369Gail DelaneySpectatorHere 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’ );May 13, 2015 at 12:22 am #10371Merv BarrettKeymasterThey work. Just be careful not to add an additional
<?php
in the file.Attachments:
You must be logged in to view attached files.May 13, 2015 at 12:50 am #10373Gail DelaneySpectatorThank you 🙂
May 13, 2015 at 12:57 am #10374Gail DelaneySpectatorAh, 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’ );
May 13, 2015 at 8:45 am #10378Merv BarrettKeymasterAh 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 🙂
May 13, 2015 at 8:46 am #10379Merv BarrettKeymasterAlso if you get a chance please leave a review of Easy Property Listings plugin on WordPress.org
-
AuthorPosts
These forums are closed to new replies / tickets. Please open a support ticket from our new Support page.
- The forum ‘Priority Support’ is closed to new topics and replies.