• Hi,

    On my site I have made edits to both template files for the plugin (e.g. single-listing.php) and also to this file to add my own custom field (listing-details-metabox.php).

    I am curious if there is or could be a way to ensure that when I update the plugin I don’t overwrite the changes to listing-details.metabox.php. The template files work in my child theme perfectly but I am worried that the metabox file will be overwritten. Is there any kind of hook that I can use to prevent that?

    Thanks!

    https://www.ads-software.com/plugins/wp-listings/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author agentevolution

    (@agentevolution)

    There currently are no hooks for the listings details metabox, but we’ll look into adding some in a future update.

    Was wondering the same thing as kbpalmer and have attempted to write a filter to remove specific parts of the metaboxes (but it hasn’t worked).

    Why a filter? Like kbpalmer we could edit listing-details-metabox.php but it would be overwritten in an update *and* because “Extended Details”, “Additional Details” and “Price Options” don’t work for my client. We’ve registered other taxonomies that work for them perfectly and are easier to query and display.

    Two questions:

    1) Do you have any filter code you could provide that would, in fact, remove “Extended Details” and “Additional Details” and “Price Options”?

    2) Would removing them cause an issue now or a future issue if my client wanted to import IDX listings?

    Plugin Author agentevolution

    (@agentevolution)

    The metaboxes for Property Details are added with the add_meta_box function like so:

    add_meta_box( 'listing_details_metabox', __( 'Property Details', 'wp-listings' ), array( &$this, 'listing_details_metabox' ), 'listing', 'normal', 'high' );
    add_meta_box( 'listing_features_metabox', __( 'Additional Details', 'wp-listings' ), array( &$this, 'listing_features_metabox' ), 'listing', 'normal', 'high' );

    You could use remove_meta_box in a custom function to remove them altogether.

    And if you wanted to add your own custom metaboxes you could then use add_meta_box again to include your own custom metaboxes.

    Hmm…this is not easy. Using “remove_meta_box” gives all sorts of “isset” errors. Any way to just hide them?

    Plugin Author agentevolution

    (@agentevolution)

    You can add an admin stylesheet and use the following CSS to hide those metaboxes:

    #listing_details_metabox,
    #listing_features_metabox {
    display: none;
    }

    I would like to get rid of the Extended Details section also. Where would one put an admin stylesheet?

    Plugin Author agentevolution

    (@agentevolution)

    This varies from theme to theme. Some things offer their own Custom CSS section otherwise you will need to add it to your current theme style.css file or modify your theme to load an additional stylesheet.

    Ah, sorry! I guess I was not talking about the same thing after all! I am trying to get rid of it from the admin screen. I did try enqueing an admin style sheet but it did not work – also I am just trying to get rid of the Extended Details and #listing_details_metabox would get rid of the whole details section (Property Details and Extended Details) if it did work.

    Plugin Author agentevolution

    (@agentevolution)

    But what will I enqueue? As I mentioned, there is no unique ID or class for the Extended Details.

    Plugin Author agentevolution

    (@agentevolution)

    Ah sorry, you’re right. Didn’t fully understand your question.

    What you can do it use a filter to pass an empty array to the extended_property_details:

    add_filter('wp_listings_extended_property_details', 'my_extended_details');
    function my_extended_details() {
    $details = array();
    return $details;
    }

    That works, thanks! The listing admin still shows the “Extended Details” heading and the Div’s where the fields would go, but I can live with that. Thank you!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Hooks and Filters’ is closed to new replies.