Solved

Generate a list of all WordPress shortcodes available in a theme

Posted on 2014-09-16
5
169 Views
Last Modified: 2014-09-17
Is there any way to get a list of all shortcodes available in an installed theme? Preferably, with available parameters. I found one plugin, but it doesn't list the parameters, only the shortcodes:

http://wordpress.org/plugins/shortcode-dropdown/

If I can't do this from within WordPress, or by generating a custom page of some kind, then can I find this out by digging through the theme files somewhere? Not sure where to look.

Thanks!
0
Comment
Question by:bbdesign
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40325555
Ugh.  This would be handy.

At this time, the only way to do it that I know of is to look through functions.php and follow the code there and see where it takes you. Some themes make a ton of calls to external class files so you have to really understand the theme construction to be successful.

Please note that the above would work for theme-based short codes.  Codes found In the core or in plugins are located elsewhere.
0
 
LVL 32

Accepted Solution

by:
DrDamnit earned 250 total points
ID: 40325740
Shortcodes (if I remember correctly) are loaded into array. So, it stands to reason that of you dumped the array contents, you can get your list.

As far as parameters go, however, you have to either look at the code or is documentation.
0
 
LVL 70

Assisted Solution

by:Jason C. Levine
Jason C. Levine earned 250 total points
ID: 40326019
So, it stands to reason that of you dumped the array contents, you can get your list.

Mike, I'm pretty sure that's what the plugin listed above does, albeit with integration into TinyMCE for style points.  Oddly enough, that plugin has zero activity, not sure why.

You're 100% right, though:

<?php
global $shortcode_tags;
echo "<pre>"; print_r($shortcode_tags); echo "</pre>";
?>

Open in new window


ref: http://wordpress.org/support/topic/how-to-list-all-active-shortcodes
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 40326100
Yeah, so to get the list he wants, he can disable the theme, then dump the array. Then enable the theme, and dump the array again. The "new" items in the second dump would be the shortcodes he wants. (You'd have to diff the two lists)
0
 

Author Comment

by:bbdesign
ID: 40328504
Thanks for the suggestions, guys.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wordpress Horizontal Drop-Down Menu In this tutorial I will show you had to add a WordPress horizontal navigation menu to your theme. I have searched and searched for a good tutorial on creating a WordPress nav menu without adding a plug-in or us…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
This video teaches users how to migrate an existing Wordpress website to a new domain.
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question