• Hi everyone,

    I’m creating pages that may require access to the database to populate areas on my page. All research I’ve done on the subject discuss creating a plugin and creating tables to database from within the plugin that you create.

    So I have a few questions:
    Can I simply make a call to the database from inside any page?
    Do I have to wrap the page in a php file to access the database?
    Can I access the database from any php file without having to create a plugin?

    Sorry for such newbie questions.

    Please help!

    Thanks!

Viewing 1 replies (of 1 total)
  • I am not a coder, so I cannot help you actually get this done. However, I do believe I have some answers that might help…

    Can I simply make a call to the database from inside any page?

    WordPress runs in/on php, and plugins use php to make calls to the database. So, can you use php to do that from a page? Yes, and I believe plugins do that by using shortcodes. So, you would just need a shortcode to embed on a page to make calls to the database.

    Do I have to wrap the page in a php file to access the database?

    See above about embedding a shortcode on a page.

    Can I access the database from any php file without having to create a plugin?

    I cannot presently think of any example I happen to already know about, but plugins use functions and functions can be added to a Child Theme. So, it should be quite possible to add functions to a Child Theme to make a custom shortcode available that will make calls to the database from a page.

Viewing 1 replies (of 1 total)
  • The topic ‘Can I access the database from within a page?’ is closed to new replies.