WordPress.org

Ready to get started?Download WordPress

Forums

Creating own shortcode to get_template_part ? (3 posts)

  1. johnfotios
    Member
    Posted 1 year ago #

    I want to define my own shortcode in Functions .php, and I want it to get a .php file from the theme.

    I've created a map.php, and want the shortcode [map] to pull it in where ever. It doesn't have to have a button on TinyMCE or anything. Just to work when I type it in.

    I've found a plugin which lets you create your own shortcodes and use them to return text, but I doubt it'll let me use php. Although I might just need to return html actually.

    I'll have a think x)

  2. s_ha_dum
    Member
    Posted 1 year ago #

    Did you have a question?

  3. Marty Spellerberg
    Member
    Posted 1 year ago #

    Hi John,

    I've created a plugin for that.

    http://wordpress.org/extend/plugins/template-part-shortcode/

    You'll be able to call your part using the syntax [template part="map"]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.