[wp-hackers] Shortcodes in Custom Menu Items

Jesse Friedman jfriedman at astonish.com
Thu May 30 21:45:17 UTC 2013


Thanks for this Nicholas, that's what i needed.

The reason is I want to be able to do http://subdomain._siteURL_/about-us
so that i can link to subdomain sites that are prelive


On Thu, May 30, 2013 at 5:28 PM, Nicholas Ciske <nl at thoughtrefinery.com>wrote:

> Oops, had an extra http:// in there due to the way URLs get sanitized.
>
> Moving the code to a gist:
> https://gist.github.com/nciske/5681384
>
> Out of curiosity, why not just use a relative URL like /test/ vs inserting
> the site url in front?
>
> _________________________
> Nick Ciske
> http://thoughtrefinery.com/
> @nciske
>
>
> On May 30, 2013, at 4:14 PM, Nicholas Ciske wrote:
>
> > add_filter('wp_nav_menu', 'menu_shortcodes');
> > function menu_shortcodes( $menu ){
> >       return str_replace( '_SITEURL_', home_url(), do_shortcode( $menu )
> );
> > }
> >
> > This will allow you to have site agnostic URLs and shortcodes in labels.
> Tweak as needed.
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 

*Jesse Friedman
**Director of Web Interface and Development   |  Astonish  |   **
www.astonish.com
*300 Metro Center Boulevard Warwick, RI 02886
(o) 401-921-6220  |  (f) 401-921-6225  |  (d) 401-773-7422  |
jfriedman at astonish.com


More information about the wp-hackers mailing list