The Execution of All Things
Overview
The Execution of All Things better known as wp-exec is a plugin for WordPress 1.5. Its purpose is to facilitate a transparent HTML-to-PHP API layer. Meaning that users can easily embed custom tags inside posts or pages which will then in turn be replaced by dynamic content. In most instances, this is a much cleaner alternative to the RunPHP plugin.
Current Tags Supported
- date: returns the current date and time given any format
- archives: returns a list of archives based off wp_get_archives()
- categories: returns a list of categories based off wp_list_cats()
- function: allows you to call any wordpress or activated plugin functions
- include: facilitates including one post or page within one another
- bloginfo: returns access from the bloginfo array
- links: returns a list of links based off get_links()
Download
The latest version available is: wp-exec-0.7.zip. After downloading, please read the Installation Procedures below. If you’re looking to uninstall this plugin, find the appropriate procedures on your own, jerk. (hint: they come after installation procedures)
Samples & Examples
Date: This tag is based off the built-in date() functionality of PHP. It returns the current date/time.
usage: <exec type="date" />
optional:
- format: the current date/time using PHP date() syntax. If omitted, the predefined values of WordPress are used as default.
- gmt: true or false to compensate for GMT (default: false)
Categories: This tag is based off of the wp_list_cats() functionality. It outputs a list of categories based on the parameters supplied.
usage: <exec type="categories" />
optional:
- optionall: sets whether to have an option to display all categories. (default: false)
- all: text to display for the option to display all categories. (default: all)
- sort_column: key to sort options by. (default: ID)
- sort_order: sort order for options. (default: asc)
- file: the php file a category link is to be displayed on. (default: index.php)
- list: sets whether the categories are enclosed in an unordered list (<ul><li>). (default: true)
- optiondates: display the date of the last post in each category. (default: false)
- optioncount: display a count of posts in each category. (default: false)
- hide_empty: hide (not display) categories with no posts. (default: true)
- use_desc_for_title: category description is displayed as link title. (default: true)
- children: show children (sub) categories. (default: true)
- child_of: display only the categories that are children of this category (ID number). There is no default.
- feed: text to display for a link to each author’s RSS feed. Default is no text, and no feed displayed.
- feed_img: path/filename for a graphic to act as a link to each categories’ RSS feed. Overrides the ‘feed’ parameter.
- exclude: categories to be excluded. This must be in the form of an array (ex: 1, 2, 3).
- hierarchical: display child (sub) categories in a hierarchical (after parent) list.
For more information on the optional parameters, please see wp_list_cats().
Archives: This tag is based off the wp_get_archives() functionality. It outputs a list of the archives based off of the parameters supplied.
usage: <exec type="archives" />
optional:
- mode: the type of archives to display (monthly, daily, weekly, postbypost)
- limit: truncate the number of results
- format: archive list format (html, option, link, custom)
- before: text to place before the link when using custom or html for format option
- after: text to place after the link when using custom or html for format option
- count: display number of posts in an archive
For more information on the optional parameters, please see wp_get_archives().
Function: This tag allows you to call any WordPress function (and all those available in activated plugins). You must supply the name (function name) attribute. The params attribute is optional but if it is used, should be comma separated.
usage: <exec type="function" name="…" />
optional:
- params: comma separted list of parameters to pass to the function
Include: This tag allows you to dynamically include any post or page within one another. You simply need to supply the tag the id number of that post or page. Although I do not really foresee any other data except the content being useful — the tag, nevertheless, offers an optional field="…" parameter making other fields also available.
usage: <exec type="include" id="#" />
optional:
- field: the data you want to retrieve from that post (default: content)
- author_id
- date
- content
- excerpt
- title
- category
- post_status
- comment_status
- ping_status
- post_password
- to_ping
- pinged
- post_name
Bloginfo: This tag facilitates grabbing allows you to dynamically include any post or page within one another. Although I do not really see any other data except the content being useful, the tag offers an optional field="…" parameter making other fields available. It based on the get_bloginfo($show) function.
usage: <exec type="bloginfo" show="…" />
show can be any of the following (if omitted, defaults to name):
- name: returns weblog title as set in general options (default)
- description: returns tagline for your blog as set in general options
- url: url for your blogs web site address
- rdf_url: url for RDF/RSS 1.0 feed
- rss_url: url for RSS 0.92 feed
- rss2_url: url for RSS 2.0 feed
- atom_url: url for Atom feed
- comments_rss2_url: url for comments RSS 2.0 feed
- pingback_url: url for pingback (XML-RPC file)
- admin_email: returns administrators email address as set in general options
- charset: returns the character encoding for your blog as set in reading options
- version: returns the wordpress version number that your blog uses
- wpurl: url for wordpress installation (WP 1.5)
- template_url: url for template in use (WP 1.5)
- template_directory: url for templates directory (WP 1.5)
- stylesheet_url: url for primary CSS file (WP 1.5)
- stylesheet_directory: url for stylesheet directory (WP 1.5)
Links: This tag is based off the get_links() functionality. It returns a list of links.
usage: <exec type="links" />
optional:
- category: the numeric ID of the link category whose links will be displayed. If none is specified, all links are shown. Defaults to -1 (all links).
- before: text to place before each link. There is no default.
- after: text to place after each link. Defaults to ‘<br />’.
- between: text to place between each link/image and its description. Defaults to ‘ ‘ (space).
- show_images: should images for links be shown (TRUE) or not (FALSE). Defaults to TRUE.
- orderby: value to sort links on. Defaults to ‘name’ unless you pass the value of ” (empty), in which case it sets to ‘id’. Valid options:
- id
- url
- name
- target
- category
- description
- owner: user who added link through Links Manager.
- rating
- updated
- rel: link relationship (XFN).
- notes
- rss
- rand: display links in random order
- sort: desc or asc (defaults: asc)
- show_description: should the description be displayed (TRUE) or not (FALSE). Valid when show_images is FALSE, or an image is not defined. Defaults to TRUE.
- show_rating: should rating stars/characters be displayed (TRUE) or not (FALSE). Defaults to FALSE.
- limit: maximum number of links to display. Defaults to -1 (all links).
- show_updated: should the last updated timestamp be displayed (TRUE) or not (FALSE). Defaults to FALSE.
For more information on the optional parameters, please see get_links().
Installation Procedures
Apparently I have duped you into actually downloading and installing one of my plugins… don’t worry there is still some hope for you. WordPress boasts a phenomenal plugin system therefore installation and activation really could not be any simpler. Enjoy.
- Download the Latest Available Version
- Extract the Zip Archive
- Upload wp-exec.php to your /wp-content/plugins/ folder
- Go to your WordPress Administrative Console
- Under Options -> Writing, make sure “WordPress should correct invalidly nested XHTML automatically” is unchecked
- Under Plugins, locate the “wp-exec” entry and activate it
Uninstall Procedures
So, for whatever reason, you’ve decided to insult me and shame my family by uninstalling my plugin that I worked oh-so very hard on. Huh? What do you have to say for yourself? Alright, if that guilt trip didn’t work then I guess you’re pretty serious about your commitment on destroying my life. At any rate, here are the instructions you requested, bastard:
- If you’re just looking to turn-off the plugins’ capabilities, you can simply deactivate it through the Plugins interface
- If you’re you’re looking to completely delete the files, make sure you deactivate the plugin first and then delete wp-exec.php from your /wp-content/plguins/ folder
Troubleshoot / Help
If you have any problems with this plugin, send me an email and I will do my best to help you out. I can’t guarantee that I can solve anything but I’m willing to try. If there any feature suggestions, bug reports or just general comments — please email me at wp-exec@navidazimi.com. I love you. Thanks.
Adieu. Navid.