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.
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.
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.
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.
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.
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.
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.
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
Let us know if you get this resolved… but returning rather than echoing the results will most likely bring joy.
Apologies, yes, it’s all sorted now and looking great.
Thanks very much for all your help, fantastic responses!
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.