• Skip to primary navigation
  • Skip to main content

RocketGeek

Home of WP-Members, The Original WordPress Membership Plugin

  • WordPress Plugins
    • WP-Members
      • FAQs
      • Quick Start
      • Documentation
      • Extensions
    • Advanced Options
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Download Protect
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Invite Codes
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • MailChimp Integration
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • PayPal Subscriptions
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Salesforce Web-to-Lead
    • Security
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Text Editor
      • Purchase the Plugin
      • Get the Pro Bundle
    • User List
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • User Tracking
      • Documentation
      • Purchase the Plugin
      • Get the Pro Bundle
    • Memberships for WooCommerce
    • WordPass
  • Blog
    • Basics
    • Tips and Tricks
    • Filters
    • Actions
    • Code Snippets
    • Shortcodes
    • Design
    • Release Announcements
  • Store
    • Cart
    • Checkout
  • Contact
  • Log In
  • Show Search
Hide Search
Home » Shortcodes » Adding shortcodes to other locations

Adding shortcodes to other locations

Chad Butler · Aug 27, 2012 ·

This article is provided free. Find out how you can get full access to premium content, including how-to articles and support forums, as well as priority email support and member exclusive plugin extensions..

 

By default, WordPress only parses shortcodes in the main content area. Suppose you want to use shortcodes (WP-Members or otherwise) in locations other than the body text?  Here are some snippets you can add to your theme’s functions.php file to allow the use of shortcodes in the sidebar, comments, and excerpts: 

Allow parsing of shortcodes in the sidebar:

add_filter( 'widget_text', 'do_shortcode' );

Allow parsing of shortcodes in comments:

add_filter( 'comment_text', 'do_shortcode' );

Allow parsing of shortcodes in excerpts:

add_filter( 'the_excerpt', 'do_shortcode' );

Allow parsing of shortcodes in menu items:

add_filter( 'wp_nav_menu_items', 'do_shortcode' );

Shortcodes, Tips and Tricks filters, shortcodes, tips

Ready to get started?

Join Today!

© 2025 · butlerblog.com · RocketGeek is built using WordPress, WP-Members, and the Genesis Framework

  • butlerblog.com
  • WP-Members Support Subscription
  • Terms of Service
  • Privacy Policy
  • Refund Policy