WordPress.org

Ready to get started?Download WordPress

Forums

Adding query results to a WordPress page (5 posts)

  1. bartpe
    Member
    Posted 2 years ago #

    Hi all,
    What's the best way to add a DB query result to a WordPress page?
    I need to insert a counter value in a WP page. This counter field is queried from a Mysql DB.
    Do I just enter code in the HTML view of the page or is there a better way?
    Kind regards,
    Bart.

  2. bartpe
    Member
    Posted 2 years ago #

    bump

  3. Safirul Alredha
    Member
    Posted 2 years ago #

    Use Shortcodes. Create your own.

    http://codex.wordpress.org/Shortcode_API

  4. bartpe
    Member
    Posted 2 years ago #

    ok thanks, and where do I define these handlers? In functions.php of the theme?

  5. Safirul Alredha
    Member
    Posted 2 years ago #

    Theme's functions.php is ok. But I recommend adding it as a plugin so that the shortcode would still work even if you change theme.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.