• Resolved agthalim

    (@agthalim)


    Hi Camille,
    Thank you so much for this wonderful plugin !
    I would like to ask you advice as to how I can customize the contents of my popovers. Indeed, readme.txt says: “You can also disable the plugin’s CSS if you want to design your own popups” ; disabling was an easy option to find. But what I would like now is how I can include links to a some relevant articles inside the popover .
    So far these two files seem directly related to my concern :
    public/js/generate-popover-html-output.js
    public/js/dist/travelersmap-bundle.js

    I have two questions :
    – is the contents of the popovers determined by these files (as it seems to me)?
    – How can I override these functions? Directly inside functions.php of my theme? Seems akward : they are written in js and I don’t know (yet!) how to handle this…

    Thank you in advance !
    Amal

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Camille V

    (@socrapop)

    Dear Amal,

    • Yes, the popovers HTML are generated in generate-popover-html-output.js. The javascript is then bundled into a file with webpack: travelersmap-bundle.js So the file loaded on your page is travelersmap-bundle.js if you want to modify it without running webpack.
    • You can’t override javascript functions unfortunately. What you are trying to accomplish is not possible without modifying the plugins code. Be aware that your modifications will be lost if you update the plugin in the futur.
    • The next update will bring the possibility to add custom fields to the markers. But it is not yet ready : https://github.com/Socrapop/travelers-map/tree/2.2.0

      However, if you are not using the excerpt on your website, you could use it to add some links to the popovers. First in the Travelers’ Map setting, you have to check “Excerpt” in the popover content. Then, write the excerpt you want on your posts, like <a href="#">Link</a> and they should appear in the popover.

      Have a nice day,
      Camille

    Thread Starter agthalim

    (@agthalim)

    Hi Camille,
    Thank you for this fast and clear answer.
    Does the exerpt have to be at the beginning of the single.php page, or can I define it independently ?

    Plugin Author Camille V

    (@socrapop)

    No, the excerpt is simply set in your administration area in each post. You can check this tutorial to set the excerpt https://wpshout.com/quick-guides/set-custom-post-excerpt-in-wordpress/

    Thread Starter agthalim

    (@agthalim)

    Hello Camille,

    Thank you for this very interesting solution : using exerpts to display custom information corresponding to each marker. So far I wrote a function ‘texteHTMLPopover’ generating relevant things (title, one link to some other article whose id is in a custom field).

    Let me be more detailed for the whole structure : each article is either an ‘issue’ or a ‘creation’. I have a custom field (‘num_enjeu’), and if ‘creation’ $id is related so some ‘issue’ (which is described in article $numEnjeu) then then for the article $id, the custom field is $num_enjeu

    I can esasely get the ‘issue’ related to a given ‘creation’ :

    get_post_meta($id,'num_enjeu_situé',true)

    I’m having trouble getting a list of all ‘creations’ related to a given ‘issue’. I actually did this in the single.php page (probably a very unefficient solution) : the beginning of the single page fils some $GLOBALS table which keeps track of which is the article referred for each. For filling this table, I use two successive loops. And then I use it to list all ‘creations’ related to some ‘issue’.

    Now I tried to do the same thing inside the function which builds the exerpt, but it doesn’t work out.

    So I can’t find out a technical solution for getting the list of all articles which have some id in their custom field, in the exerpt.

    Can you suggest some way ?…

    Thread Starter agthalim

    (@agthalim)

    Would using get_posts with some relevant query as an argument be a solution ?…

    Thread Starter agthalim

    (@agthalim)

    .

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘popover (popup) contents’ is closed to new replies.