• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Updated Plugin - List of Docs is now Code

bebach

New member
Messages
2
Likes
0
Points
1
#1
I was recently put in charge of updating our website after we lost our website admin. Not knowing it would break our code, I updated the plugin. Now, instead of seeing a list of documents, I'm seeing the code. Instead of reverting back to the old version, I want to fix this code so the list will work (do the right thing, not the easy). Unfortunately, I'm so rusty with code that I have no idea how to fix this to make it work. I've been fighting with this for two days now and am just stumped. If someone could let me know what I need to do to fix the old code so it starts working again with the current version, I would greatly, greatly appreciate it.

This is the code that was working to pull our doc list forward:

[insert_php]
$dir = "/var/www/html/wp/wp-content/uploads/XXX/XXX";
$files = array();
$dh = opendir($dir); // open the cwd..also do an err check.
while(false != ($file = readdir($dh))) {
if(($file != ".") and ($file != "..") and ($file != "index.php")) {
$files[] = $file; // put in array.
}
}
natsort($files); // sort.
// print.
foreach($files as $file) {
echo '' . $file . '
';
}
[/insert_php]


Thank you!
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#2
Hello.

You need to enable support for old [insert_php] shortcodes in the plugin settings.
Or move the code to a new shortcode format: create a snippet and put the code there.