WordPress.org

Forums

Custom field code added to php page but none show up!? (1 post)

  1. fathernugen
    Member
    Posted 4 years ago #

    Hi,

    This is my first time here, and I'm afraid I get a bit jumbled up when asking questions so be patient with me.

    I have a custom wordpress theme which is working as a CMS for a client of mine.

    The site in question is here:

    http://www.lucyyoungart.com/print_categories/prints-for-sale/

    As you will see the gallery thumbnail images have some extra data below them, the price for various sizes and a add to cart button.
    To create them I copied and pasted some code (below) to the .php page I needed it on (prints-page.php). What the field does is show a certain button of my choice then attaches a paypal value to it to people can purchase the prints.

    This is the code I copied:


    <? gpm('paypal_link','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/paypal20.png" /></span>')?>

    I changed the name paypal_link to other names I needed, and changed the image path url to point to the image I wanted to use with a particular value.

    Everything was sweet. I have 6 different images in the custom field section with different prices on each. So when I add a post to the prints category I work out which field I need, and add them from the drop down menu on the add posts page.

    This was working well for one page.

    Now I wish to add different custom fields to different pages. Easy, I thought. So I followed the same path as before. And now I have added the following code, and the images needed, in the hope that I could now have a variety of custom fields some for prints, some for originals, etc.


    <? gpm('original-10-100','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-10-100.png" /></span>')?>
    <p></p>
    <? gpm('original-12-170','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-12-170.png" /></span>')?>

    <? gpm('original-8-235','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-8-235.png" /></span>')?>

    <? gpm('original-14-250','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-14-250.png" /></span>')?>

    <? gpm('original-16-320','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-16-320.png" /></span>')?>

    <? gpm('original-12-320','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-12-320.png" /></span>')?>

    <? gpm('original-20-375','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-20-375.png" /></span>')?>
    <p></p>
    <? gpm('original-24-455','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-24-455.png" /></span>')?>
    <p></p>
    <? gpm('original-24-495','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-24-495.png" /></span>')?>
    <p></p>
    <? gpm('original-30-725','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-30-725.png" /></span>')?>
    <p></p>
    <? gpm('original-30-825','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/original-30-825.png" /></span>')?>
    <p></p>
    <? gpm('cards-6','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/cards-6.png" /></span>')?>
    <p></p>
    <? gpm('cards-10','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/cards-10.png" /></span>')?>
    <p></p>
    <? gpm('cards-20','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/cards-20.png" /></span>')?>
    <p></p>
    <? gpm('vouchers-25','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/vouchers-25.png" /></span>')?>
    <p></p>
    <? gpm('vouchers-50','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/vouchers-50.png" /></span>')?>
    <p></p>
    <? gpm('vouchers-100','<span class="paypal"><img src="'.get_bloginfo('template_url').'/core/trend_images/vouchers-100.png" /></span>')?>

    After adding this code I went back to add a print post in the print category. I hoped that the custom fields would now turn up in the drop down menu so I could apply them to new posts that are created.

    But unfortunately, nothing happens. I thought it might be limiting the amount of custom fields I was using. But i found some code to increase that and nothing happened.

    If you need me to expand, or be more precise about some things written here then let me know.

    I hope some one can prevent me from going bald rapidly.

    Surya Osborne.

Topic Closed

This topic has been closed to new replies.

About this Topic