WordPress.org

Ready to get started?Download WordPress

Forums

Display quote for individual pages (not random)? (2 posts)

  1. cbpride
    Member
    Posted 7 years ago #

    I'm converting my site to WordPress, and there is an area on the layout I'm using for a quote to be displayed. The quote isn't random - it's a specific quote, different for each page. Like a mini page description, I suppose. Like this:

    http://katie.charismatic-insanity.net

    On the image at the top, there's a little faded box witha sentence or two in it, and it changes as a description for each page.

    I need to know how to make this work with WordPress. I'm not good with PHP, but if there was a way that there could be a PHP file with all the descriptions on it, and each description was associated with a page, and then that file was included to show only the quote for the page it was included on... I don't know. There must be some way to have them work. Can anybody help?

    (I'm testing my WordPress here: http://katmor1.freehostia.com/wordpress )

    Thank you,
    Katie

  2. Doodlebee
    Member
    Posted 7 years ago #

    You could create a functions.php file and put it in your theme files (if you don't already have one - if you do, you can just add to it)

    Write (or add) something like this:

    <?php
    function cbpride_quotes() {
    if (is_home()) { ?>
    <p>quote for home page here</p>
    <?php } else {
    if (is_category('1')) { ?>
    <p>quote for category 1 here</p>
    <?php }
    } //end function
    ?>

    Then, in your template files (I'm guessing you want it in the header?) put in <?php cbpride_quotes(); ?> where oyu want it to appear.

    Not the *best* solution, I'm sure, but it'll do what you want, and you'll have one file where all the quotes are listed.

Topic Closed

This topic has been closed to new replies.

About this Topic