• Resolved James Roberts

    (@james-roberts)


    Hi Matt,

    First off, great work on Shortcodes Pro, it is proving to be a very handy tool. I have just one question, in the custom PHP code section of the UI, can I get the post_id of the current post? I have tried using $content[‘ID’] but with no luck, is there some built in var with the post info that can be used? I need to do this as I am running an SQL query in my shortcode and the where clause needs to take in the current post ID. Hope all that makes sense.
    Thanks again for such a cool plugin ??

    Kind regards,
    James Roberts.

    https://www.ads-software.com/extend/plugins/shortcodes-pro/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt

    (@sksmatt)

    Hi James,

    Thank you. From the top of my head, I think you should try passing the ID as an attribute. Not sure really if there is a safer way.

    Kind Regards!

    Thread Starter James Roberts

    (@james-roberts)

    Thanks for the reply Matt,

    Am I correct in saying to do this the user would need to know the post id as it would need specifying to get passed as an attribute? Not sure that this would be a solution as the folks who will be using the shortcode in this case are anything but computer literate so I was hoping I could set it up so when they click the button, the shortcode would get the current post id (I assumed this could be accessed in some built in var) and the rest of the code would run returning some HTML with data got from SQL queries using the post ID in the where clause. Does this sound possible?

    Kind regards,

    Thread Starter James Roberts

    (@james-roberts)

    Hi Matt,

    I just tried adding an attribute but when I click “Add Attribute” in the popup window nothing happens, also when I change the type to select I dont get any options to add, am I missing something?
    My apologies if I am just being daft ??

    Kind regards,

    Thread Starter James Roberts

    (@james-roberts)

    Any input fella?

    Thanks,

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Shortcodes Pro] Get post ID’ is closed to new replies.