• Resolved laddersrus

    (@laddersrus)


    Hi, I’ve just installed your plugin and I love it, it’s great – thanks!
    I’ve read the documentation and searched this forum, but I cannot find anything on what I want to achieve.
    I’ve created a function on my site and then added a shortcode for it with some attributes so that I can call it within the HTML editor of a WordPress page.
    Can you let me know if it’s possible to add the shortcode to trigger my function in the Target Content section of your plugin please and if so, how I’d go about this?
    Many thanks

    • This topic was modified 6 years, 6 months ago by laddersrus.

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

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author twinpictures

    (@twinpictures)

    Not sure exactly what you mean by:

    possible to add the shortcode to trigger my function in the Target Content section of your plugin

    Do you want the expand/collapse action to trigger a function, or do you simply want to place a shortcode in the hidden content of the expand element?

    Can you provide a short example of the current expand shortcode structure you are using? Regardless, we’ll help get you sorted out and happy.

    Thread Starter laddersrus

    (@laddersrus)

    Thanks for your quick response! πŸ™‚

    My function reads a specific XML file (based on my shortcode attributes) that’s hosted in a folder inside the wp-includes directory of my WordPress site.
    The XML contains PDF/MP4 file names for files which are also stored in that folder which the function reads, then creates hyperlinks for each file so that the user can click to access/download them.
    These files (XML’s which kind of act as a contents list, plus PDF’s and MP4’s) are synced from an external location to my WordPress directory and there are new versions being added and old ones removed on a daily basis. There’s an automated process that runs on a server in the external location to update the XML’s, so that they only contain current file names.

    The files are in 4 different categories… Briefs; Planograms; Useful Info & Videos and there can be quite a lot in each one.
    What I want to do is have each category listed as the visible title of a collapsible list, then when that category is clicked, my shortcode is triggered and the hyperlinks for the files within that category are displayed for the user to click.

    Hope this makes a bit more sense.

    • This reply was modified 6 years, 6 months ago by laddersrus.
    • This reply was modified 6 years, 6 months ago by laddersrus.
    Plugin Author twinpictures

    (@twinpictures)

    So is your shortcode working like so:

    [super_duper_shortcode cat="briefs"/]
    

    And this will list out all the links to your Briefs?

    Please provide an example of how your shortcode works.

    Thread Starter laddersrus

    (@laddersrus)

    Yes, very much like that…

    [filelinks client=”ClientA_(25)” type=”briefs” folder=”briefs”]

    That example looks for the XML file based on the client and type attributes, then creates the link using the client and folder attributes. They happen to be the same here, but are not for all of the categories

    • This reply was modified 6 years, 6 months ago by laddersrus.
    • This reply was modified 6 years, 6 months ago by laddersrus.
    Plugin Author twinpictures

    (@twinpictures)

    And what happens with something like:

    [expand title="Client A Briefs"]
       [filelinks client="ClientA_(25)" type="briefs" folder="briefs" /]
    [/expand]
    

    Note: Be sure to past this in the TEXT mode of the page editor so you don’t copy over any wonky text formatting and HTML bloat.

    Thread Starter laddersrus

    (@laddersrus)

    When I try that, the collapsible Title is displayed, however, the links are displayed above the title as soon as the page loads and the action of expanding and collapsing the Title does nothing, apart from change the direction of the arrow.

    Plugin Author twinpictures

    (@twinpictures)

    then check the following:
    1. make sure that your code is valid, terminated html
    2. check that your function is not simply echoing the code, but building a complete string, finally returning that contents.

    Thread Starter laddersrus

    (@laddersrus)

    I have echoed the code so I think this is where the problem is. Thanks for the heads up. I’ll get my function changed and test again

    Plugin Author twinpictures

    (@twinpictures)

    Let us know if you get this resolved… but returning rather than echoing the results will most likely bring joy.

    Plugin Author twinpictures

    (@twinpictures)

    any progress to report?

    Thread Starter laddersrus

    (@laddersrus)

    Apologies, yes, it’s all sorted now and looking great.
    Thanks very much for all your help, fantastic responses!

    Plugin Author twinpictures

    (@twinpictures)

    Great to hear you got it worked out.
    If you are happy with the plugin or the support, consider leaving a little review.
    Issue marked as resolved.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Shortcode Function in Target Content’ is closed to new replies.