WordPress.org

Ready to get started?Download WordPress

Forums

Basic Google Maps Placemarks
Excluding from search results (9 posts)

  1. taggie
    Member
    Posted 2 years ago #

    For me, it doesn't really make sense to have placemarks showing up in search results on my website.
    I've found it very easy to find out how to exclude them - a quick test and things seem to be working so I think I've got it right.
    But I wonder if this could be an option in the settings?

    (In case anyone is wanting to know how, go to core.php for the plugin, go to where the custom post type is registered, starts at line 482, then in $postTypeParams = array add ,'exclude_from_search' => true )

    http://wordpress.org/extend/plugins/basic-google-maps-placemarks/

  2. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    If enough people request it then I'll consider adding it as an option.

    Instead of editing the core files directly, you should use the bgmp_post-type-params filter. That way you can upgrade the plugin without having your customizations overwritten.

  3. kryvulena
    Member
    Posted 1 year ago #

    I'd be grateful for adding the exclusion placemarks from search results, too

  4. majato
    Member
    Posted 1 year ago #

    I agree, they should be excluded from search.

  5. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    You can use the bgmp_post-type-params filter to remove them from the search. The problem with making them excluded by default at this point is that other users are already relying on having them enabled by default, so it would create problems for them if it suddenly switched.

  6. murray654
    Member
    Posted 1 year ago #

    Please make it an option. Not keen on editing files, and then the next upgrade wipes out the changes...

    Currently if I click on a placemark in the search results wordpress says not found. So from a user perspective, how does having placemarks in the search results help the user exactly?

  7. Ian Dunn
    Member
    Plugin Author

    Posted 1 year ago #

    Murray, you don't need to edit the core files. You can create a callback function for the bgmp_post-type-params filter in a functionality plugin, or your theme, and it won't be overwritten when you upgrade the plugin.

    Something like this should do it:

    function excludePlacemarksFromSearch( $params )
    {
    	$params[ 'exclude_from_search' ] = true;
    
    	return $params;
    }
    add_filter( 'bgmp_post-type-params', 'excludePlacemarksFromSearch' );
  8. projetRSSMO
    Member
    Posted 1 year ago #

    Hello,

    Newbie here... If someone could tell me exactly where to put those few lines of code above, I would be so thankful!

    How is "a callback function" created? Where is the bgmp_post-type-params filter?

    I agree with Murray: no use for placemarks to be seen in search results, since if clicked there is no page associated with them.

    Thank you!

  9. projetRSSMO
    Member
    Posted 1 year ago #

    (just to say that taggie's method works, but I'll avoid updates)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.