• Resolved sara.mansouri

    (@saramansouri)


    Hi there,
    Thanks for the great plugin!
    In our website we need to bring the Category link in addition to title and link of the article. I wonder if by modifying the Share Event, it is possible to pull category of the article in addition to its title and url.

    https://www.addtoany.com/buttons/customize/events

    + data.url
    + ‘”>’
    + data.title
    + ‘" to ‘
    + data.service

    Thanks!
    Sara

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author micropat

    (@micropat)

    Hi Sara!

    Depending on the theme and the data available in HTML elements, probably the best way to do that is by using Document.querySelector() or similar and pulling in the returned value.

    If you’re developing the theme, perhaps add a data-category attribute to the <body> tag of pages, then you could use this JavaScript snippet, for example:

    var bodyData = document.body.dataset;
    // If the <body> tag has "data-" attributes in the HTML like:
    // <body data-category="News">
    if (bodyData && bodyData.category) {
      // Your stuff here.
    }
    Thread Starter sara.mansouri

    (@saramansouri)

    Great! Thanks for your reply @micropat!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pulling article category in addition to title and link of the article’ is closed to new replies.