Support » Plugin: OSM - OpenStreetMap » OSM and Custom Post Type

  • Hello,

    First of all thanks again for the last OSM update.

    My question.
    All my articles are created with a Custom Post Type.
    – The general map does not list them
    – The widget does not work anymore.

    If I do the test with a normal article type, it works (general map and widget in the sidebar).

    How to make OSM work with CTP?

    What I do :
    1- I set the geotague on my article (it’s a Custom post Type and osm proposes it to me)
    2- I created a general map (but it does not show the markers of these articles created with the Custom post Type)
    3-The widget in the sidebar either.
    4- Generally speaking: the widget does not seem to work when it is used with Elementor.

    Thank you for your help

    to say thank you, here one of the websites that I made using osm: http://www.louisiane.cheminsdelafrancophonie.org/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author MiKa

    (@photoweblog)

    Hello,

    for custom post types you have to adapt your osm shortcode manually:

    
    [osm_map_v3 map_center="52.795,23.51" zoom="3" width="95%" height="400" tagged_type="post" marker_name="wpttemp-yellow.png"]
    

    where
    tagged_type="post"
    gets something like
    tagged_type="your_custom_post_type"

    Keep in mind, there are several strings for a cpt. The internal string/slug needs to be set for tagged_type, which is independent form the wp installation language.

    Br, Mika
    PS: Your site looks great!

    Hello Mika

    Thank you indeed I understand.
    But it does not work.
    The map is displayed well but without the markers of the geolocated items.

    But I do not understand what you said here:

    Keep in mind, there are several strings for a cpt. The internal string / slug needs to be set for tagged_type, which is independent form the wp installation language.

    My very relative English and my lack of developer experience do not help me understand what you mean. If needed I can give you access to this test site.

    Plugin Author MiKa

    (@photoweblog)

    Hello Dom,

    I do not know which way you created your custom post types. If you did it by your own within a theme you will have a code that says something like:
    register_post_type( 'your_custom_post_type', $cpt_args );
    Where “your_custom_post_type” is the string you have to add to the osm plugin shortcode as tagged_type=”your_custom_post_type”.

    If you – for any reason – do not know the slug of your cpt and there is no documentation, I will add the feature to trace it from the WP OSM Plugin next weekend.

    Br, Mika

    Hello Mika,

    Yes I have in my function file
    register_post_type ('communautes', $ args);
    and I put the OSM shortode:
    [osm_map_v3 map_center = "45.7241, -49.8042" zoom = "3" width = "100%" height = "400" tagged_type = "communautes" marker_name = "wpttemp-yellow.png"]
    But that does not work …
    But that does not work …

    For the record, I’m French, I’m currently in Poland to make a website for Canada, I think it’s fine for a mapping plugin!

    • This reply was modified 5 months, 3 weeks ago by Dom Martigne.
    Plugin Author MiKa

    (@photoweblog)

    Hello Dom,

    this looks fine.

    But it seams there are no communates with geotags.

    Can you set a geotag for a standard post, save it and reopen it. Then you will find a custom field called OSM_geo_data. Did you see this at the standard post.

    Then go to the cpt, save a geotag and reopen it – do you also see this custom field?

    Br, MiKa

    Hello Mika,

    Sorry to respond with decallage but I have not here a good conexion.
    Yes I did the tests and created a page for you on the test site:
    http://acadie.artybi.com/

    For the tests
    No problem to geolocate CPT articles and see custom fields.
    When I created the article for you, it is well geolocated (we see it on the map) but I do not have the custom fields in the editor.
    For the cpt: Everything is ok. (I did it again at the same time) …

    Plugin Author MiKa

    (@photoweblog)

    Hello Dom,

    pls post a link to:

    * the post / page with the geolocation
    * the post / page with the map that should show all geolocations

    Br,
    MiKa

    PS: If you do not see custom fields then go to [Screen Options] at the editor and enable “Custom Fields”.

    Langue source : Anglais
    Hello,
    Sorry for so many problems …

    * the post / page with the geolocation
    118/5000
    it (the custom fields are not displayed but the marker is displayed on the map – normal article)
    http://acadie.artybi.com/for-mika-some-indications/

    * the post / page with the map that should show all geolocations
    http://acadie.artybi.com/
    this one (custom post type – the custom fields are displayed – the widget works – but they do not display on the general map)
    http://acadie.artybi.com/communautes/les-pecheurs-a-saint-pierre-et-les-acadiens-a-miquelon/

    PS: If you do not see custom fields then go to [Screen Options] at the editor and enable “Custom Fields”.
    Yes it’s activated

    Dominique

    Plugin Author MiKa

    (@photoweblog)

    Hello Dominique,
    I could see it, but I have no idea. I will add some additional info to the plugin to get some tracing of the custom posttypes, the categories and the tagged posts … Will provide it within the next week.
    Br, MiKa

    Hmm, ok thanks. For the moment I will trannsform all the articles of the custom post type in normal articles until a solution emerges!
    Good week
    Dominique

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.