Support » Plugin: GEO my WordPress » I'm guessing this can not display maps of posts in categories

  • Resolved kevin heath

    (@ypraise)


    I’ve been playing around with this plugin and the global maps plugin for a while now and with practically no documentation I’m beginning to see the limitations of the plugin.

    I’m guessing that this plugin is not able to display a map of posts within a category.

    I’ve been able to limit maps by post type ie location or events but don’t seem to be able to find a way of displaying posts within categories of the post type.

    I want to display a map of all caving sites from the category ‘caving’ within the locations post type. Bu that does not appear to be possible.

    Have I missed something or is this not possible. I have the global maps add-on which I thought would make this available but it does not.

    Thanks
    Kevin

    https://wordpress.org/plugins/geo-my-wp/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    HI Keven,
    Thank you for the purchase of the add-on.

    I apologize for the missing documentation. It is indeed the “weak point” of GEO my WP and the area that needs the most improvement. I am aware of that and very soon will start to work on that. I am currently trying to finish the next major update of GEO my WP 2.5 and I am updating the add-ons to be compatible with it. Once I am done and release the new version I am going to be working mostly on GEO my WP website and the documentation. Until then you are more than welcome to ask me anything. You can also use GEO my WP official forum where you can possible find some useful information.

    As for your question, it should be possible to display Global Map by category. In the form editor next to each post type that you choose you can also choose to either include or exclude any of the post type’s taxonomies and you can also exclude taxonomy terms by term ID. So in order to display a certain category ( term ) you will need to exclude all the other categories by entering their term ID, comma separated, in the Exclude terms ( by IDs ) input box.

    Does it make sense?

    To let you know that I am now working on the new version of the Global Maps add-on. I am redoing the add-on from scratch and adding many powerful features. The new version if ajax powered and have way more filtering options. It is worth waiting.

    Also, the hooks provided makes GEO my WP super flexible and makes it possible to do almost anything with it. Features that do not exists “out of the box” will most likely be possible using a hook and a script.

    So again, if there is anything that you want to do which is not provided by UI ask me and I will try to provide you with a solution.

    Let me know if the solution above helps.

    Thank you,
    Eyal

    Hi Eyal

    thanks for the reply.

    the exclude taxonomies does not work unfortunately. When I select exclude taxonomies option and add some term IDs then the map only display my current location it does not display any locations.

    This also happens if I select the exclude options and leave the field empty.

    When I select the include option then all the places of the location post type displays. It seems that the categories on the custom taxonomy is not being recognised.

    maybe its because I’m using the development version 2.5 of the plugin that the addon is not working.

    I think I might have a hunt through the code and see if I can just produce a simple shortcode with a basic post type and category attribute option that I can put in the shortcode.

    I look forward to the new updated global maps add-on.

    thanks
    Kevin

    Plugin Author Eyal Fitoussi

    (@ninjew)

    Hi Kevin,
    Indeed the Global Maps add-on is not yet compatible with GEO my WP 2.5. That is the main reason I am holding off the official release of GEO my WP 2.5. I need to finish the update of the add-ons.

    But there is a work around for you. without the need of the Global Maps add-on but only using GEO my WP 2.5.

    Follow the steps below:

    1) Create a new Post Types form in the back-end.

    2) Under the “Search Form” tab for the “Search Form Template” dropdown choose “– Disable Search form –“.

    3) Move to “Page Load Results” tab and check the “Display locations on page load” checkbox.

    4) Check the checkbox of the post type which the category you want to display belongs to.

    5) For the “Display Map?” radio buttons check “Using shortcode”.

    6) For Results Per Page text box use -1 ( to display all results ).

    Above are the basic settings you need for the map to work. You can setup other filters in this tab as you wish.

    7) Go to your map page and add the shortcodes:
    [gmw form=”form_id”]
    [gmw map=”map_id”]

    8) Open the functions.php file of your theme and add the script below:

    function gmw_display_results_by_category( $tax_args, $gmw ) {
    
    	$tax_args = array(
    			array(
    					'taxonomy' => 'category',
    					'field'    => 'slug',
    					'terms'    => 'uncategorized',
    			)
    	);
    	return $tax_args;
    
    }
    add_filter( 'gmw_pt_tax_query', 'gmw_display_results_by_category', 10, 2 );

    The example script will filter the results based on taxonomy “category” and term “categorized”. You will need to adjust it based on your needs ( your taxonomy and term to display).

    9 ) save the file and test the page.

    Basically what I did above is I use the new Page Load Results tab to display a map of post type post on page load. I also choose to hide the search form which results in a mashup map of posts. And last thing I did is added a script which filter the wp_query to display only posts belongs to “uncategorized” term.

    Let me know if that help.

    Hi Eyal

    thanks for that.

    It’s a good base to work from. I might make a few changes to the code so that the category and term is picked up on the category archive page load.

    But you’ve saved me lots of time 🙂

    thanks for the very quick responses.

    Kevin

    Plugin Author Eyal Fitoussi

    (@ninjew)

    You are very welcome. And yes, you can do so much with it specially since GEO my WP uses the native WP_query to query results.

    A note for the script above; You probably want to do a form ID check to make sure that the script runs only on that particular form:

    function gmw_display_results_by_category( $tax_args, $gmw ) {
    
        if ( $gmw['ID'] != the_form_id_here )
            return $tax_args;
    
        the rest of the original code......

    Let me know if you have any more questions. As I said above, there is so much “behind the scents” which makes GEO my WP so powerful. I cannot obviously add every little feature to the plugin’s UI but when using the right hooks you can do just about ( almost ) anything.

    Hi Eyal,

    You are right about it being powerful.

    I’ve used the code you gave as a basis for my custom post archives php file and it works really well.

    http://lovebreconbeacons.co.uk/location_cats/caving/

    I look forward to you getting all the add-ons up to date for the new release.

    Thanks again for a great plugin.

    Plugin Author Eyal Fitoussi

    (@ninjew)

    Hey Kevin,
    I got first beta of the new version of Global Maps add-on if you’d like to test it. I Think you gonna like it.

    If you want to test please contact me via info@geomywp.com and I will send it over.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘I'm guessing this can not display maps of posts in categories’ is closed to new replies.