Having recently reviewed the WordPress plugins that are available to assist with the current cookie legislation I was dismayed to find a lack of anything simple that would be list out the shortcodes on a site, yet provide some flexibility.
So, I’ve written something.
Add the code below to the functions.php file in your theme folder and then use the following shortcode in a post or page…
[cookies]
Simple, eh? This will list all the site’s cookies along with their values. Two further options are available…
[cookies novalue]
This will now output the cookie values.
[cookies] ==> [/cookies]
By providing a value between opening and closing shortcodes you can override the text that is used to separate the cookie name and the value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The above code throws a syntax error: unexpected ” : “, expected ” )”. I have no idea what this means, I don’t understand php coding. Good thing I had a backup of the functions.php, it broke my site.
Leave a Reply to Agnes Preszler Cancel reply