WordPress.org

Forums

Custom Content (2 posts)

  1. jdhuntington
    Member
    Posted 10 years ago #

    I'm new to the world of writing plugins. I've been using wordpress for a year or so, but just recently have discovered all that it can give me.
    My question is How can I add my own custom content to my page? In other words, is it possible to have another DB table and pull content from that table, then put it in its own space on the index.php?
    One example would be a quote of the day plugin. Ideally, I would like to be able to login to the admin console, and from there edit all of the quotes in the database. Then, when the index page loads, a random quote is pulled and inserted near the top of the page or something like that.
    I know that there is a hack currently that can do this, but I noticed it does not utilize the plugin interface.
    Are there hooks available that will allow me to do this?
    Thanks

  2. mike
    Member
    Posted 10 years ago #

    Yes. You would need to create files that can connect and modify the new table. Like add-quote.php, edit-quote.php, etc. You could easily integrate this into index.php with another include at the top, like:
    <?php include("wp-blog-header.php");
    include("quotes.php"); ?>

    Quotes.php would contain all the functions/calls you need, so that somewhere on index.php you could call say:
    <?php random_quote(); ?>
    "Simple" as that:).

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.