• Resolved steighne

    (@steighne)


    Hi Codepeople ??
    I’d love to filter/hook a way to use a marker based on the category or taxonomy…
    e.g. MarkerA if TaxonomyA, MarkerB if TaxonomyB, etc.

    Is there any documentation on how to do this, most likely in my child theme’s functions.php file?

    Owned the pro version for years and love it–thanks for this plugin.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    The shortcode attributes are described in the following link:

    https://wordpress.dwbooster.com/content-tools/codepeople-post-map#attr

    Best regards.

    Thread Starter steighne

    (@steighne)

    Hi Codepeople,

    I’m looking for something like [codepeople-post-map taxonomy=”taxonomyA,taxonomyB” taxonomyA_marker=”url/markerA.png” taxonomyB_marker=”url/markerB.png”]. Your shortcodes attributes do not include this function. Is there a hook or filter that can get this done?
    Thanks for the response.
    Richard

    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    If you want to replace the markers icons by programming, you can use the cpm-point-image filter. the callback function receives two parameters, the current icon’s URL, and the id of the post or page where the point was defined.

    Best regards.

    Thread Starter steighne

    (@steighne)

    Ok thanks for your help. I have read this on your site and tried it multiple ways. It doesn’t seem to be doing anything…
    function point_image($url, $post_id)
    {
    return ‘https://www.yourwebsite.com/path-to-the-image/image.jpg’;
    }
    add_filter(‘cpm-point-image’, ‘point_image’, 10, 2);

    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    Please, let me know where you have inserted your piece of code. Furthermore, since you are using a plugin for caching the website, you must purge the cache to allow the changes to take effect.

    Best regards.

    Thread Starter steighne

    (@steighne)

    Thanks for the reply ??
    We are not using a caching plugin, so changes take effect straight away.
    The code is inserted on the front page of richardsteighner.com/slowfoodsandbox
    as such:
    [codepeople-post-map mousewheel="0" cat="-1" height="300" zoom="1" legend="project_category,dish" legend_class="recipe-map-legend" ]
    Kind regards,
    Richard

    PS
    my code is currently living in the functions.php file of a child theme.

    • This reply was modified 3 years, 5 months ago by steighne.
    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    Please, indicate the version number of your copy of the plugin.

    Best regards.

    Thread Starter steighne

    (@steighne)

    Hi @codepeople thanks again for the reply.
    I show 2 different versions
    On the plugins page: Version 5.0.64
    On the “view details” window: 1.0.38

    • This reply was modified 3 years, 5 months ago by steighne.
    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    Version 1.0.38 corresponds to the free distribution of the plugin. It does not support the “cat” attribute, the 5.0.30 corresponds to the Professional version, but it is outdated. You cannot have both enabled at once. If you’ve additional questions about the commercial version of the plugin, please, contact us directly through our website: Click Here

    Best regards.

    Thread Starter steighne

    (@steighne)

    Hi there,
    Thanks for that. I’ve updated to the paid version I bought (version 5.0.64).

    The function you have mentioned only updates the image associated with a particular link. I am looking for a way to filter the marker (ie the map icon) such that all posts from CatA have iconA, CatB have iconB…and so on.
    Basically looking to remove the choice for a client when they add a new post.

    Thanks for your time so far.

    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    Look your own code:

    function point_image($url, $post_id)

    The second parameter is the post id. If you know it, you can get the taxonomies associated with the post, and apply the image you want based on the term.

    Best regards.

    Thread Starter steighne

    (@steighne)

    Hi @codepeople ,
    Yes, that works for creating an image within the location’s bubble.
    I’m not looking for that. I’m looking to change the ICON (aka marker)–the little arrow that points to the spot on the map, NOT the associated image–based on the category.
    I hope I’ve made that distinction clear.
    Richard

    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    I’m sorry, the current version of the plugin does not include a filter for the points icons.

    However, it is a good feature suggestion to implement in the next update of the plugin.

    Best regards.

    Thread Starter steighne

    (@steighne)

    Hi @codepeople
    Thank you so much for your time. I appreciate your time and consideration for adding that feature to a future update.
    Best wishes

    Plugin Author codepeople

    (@codepeople)

    Hello @steighne

    I’ve published the plugin’s update. Now, you have available the cpm-point filter you can use to edit the attributes of the points. For example:

    
    // Modify the point's icon
    function edit_point($point)
    {
        $point['icon']='https://www.website.com/path-to-the-icon/new-icon.jpg';
        return $point;
    }
    add_filter('cpm-point', 'edit_point', 10);
    

    Note the points include the post_id item with the ids of the post where they were defined. For this reason, you don’t need the post’s id as the second parameter of the filter.

    Best regards.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Map Marker based on Tax or Cat’ is closed to new replies.