[Resolved] How to add shortcode into GP comment field

Home Forums Support [Resolved] How to add shortcode into GP comment field

Home Forums Support How to add shortcode into GP comment field

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #570687
    Michal

    Hello,

    I am wondering how can I add a country shortcode from geoip plugin (https://pl.wordpress.org/plugins/geoip-detect/) into GP comment field.

    [geoip_detect2 property="country"]

    From what I noticed comment field has to be a wysiwyg field (not text as it is by default). Is there any other way to do this? By custom php function or so?

    Regards,
    Michal

    #570708
    David
    Staff
    Customer Support

    You can use this GP Hook

    https://docs.generatepress.com/article/generate_inside_comments/

    It includes a link showing you how to use the hook

    #570712
    Michal

    I don’t want to have the same shortcode in each comment on my website man;)

    #570727
    David
    Staff
    Customer Support

    I am unclear as to what you need. How is it decided what shortcode goes in which comment?

    #572234
    Michal

    Imagine I am the user which want to write a following comment:

    Hello,
    My name is Alex. I came from [geoip_detect2 property=”country”] and would ike to introduce myself further.

    Blablabla
    Cheers

    That’s what I want to achieve. The shortcode from above works (show visitor’s country) on wysiwyg (posts, pages) but not inside comments.

    #572257
    David
    Staff
    Customer Support

    So if the comments field did accept the shortcode are you expecting users to add that shortcode themselves?

    #572260
    Michal

    NO, Administrator will do that

    #572269
    Michal

    Sorry David you are not helpful at all. Tom, where are you?:)

    Anyway I found a solution by myself. This addon helped resolve that issue https://wordpress.org/plugins/enable-shortcodes-inside-widgetscomments-and-experts/

    #572272
    David
    Staff
    Customer Support

    Hi Michal you may want to look at an alternative method as opening up the comments field to add html can pose a risk to the site or other users with spam content. You may want to investigate a plugin like this:

    https://wordpress.org/plugins/simple-location/

    #572274
    David
    Staff
    Customer Support

    Hi Michal, sorry i wasn’t of much assistance, somethings are lost in translation. I am glad you have found a working solution.

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