WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Custom template tags in my plugin

[Resolved] Custom template tags in my plugin

  • I’m creating a plugin using Devlounge’s How to Write a WordPress Plugin series.

    Is it possible to create a custom template tag that utilizes the database?

    There’s a catch! The Devlounge tutorial places the entire plugin inside a class, so my database information isn’t available outside of that class.

    And apparently, functions inside PHP classes aren’t available for use outside the class, so I can’t just place my <?php custom_template_tag() ?> inside my class iconoPlugins

    If I define the function within the class, it’s not possible to call the function from outside the class. If I define the function outside the class, it’s not possible to get my database information.

    I’m sure this is possible, but how? Something to do with get_option, perhaps? Or some tricky PHP wizardry?

    Thanks, guys.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Custom template tags in my plugin’ is closed to new replies.
Skip to toolbar