示例#1
0
<div id="container">
	<div id="content">
		<div id="post-17" class="hentry p1 page publish author-alex category-uncategorized tag- y2007 m07 d19 h23">
			<h2 class="entry-title"><a href="<?php 
get_option('siteurl');
?>
/buy/<?php 
product_id();
?>
">Buying <?php 
product_name();
?>
</a><h2>
				<div class="entry-content">
					<p><?php 
product_description();
?>
</p>
					<h3>Pricing</h3>
					<p>CD Album & Postage (UK) - £<?php 
product_cost_uk();
?>
<br /><a href="<?php 
get_option('siteurl');
?>
/buy/<?php 
product_id();
?>
/go-uk">Buy Now</a></p>
						<p>CD Album & Postage (Worldwide) - £<?php 
product_cost_ww();
示例#2
0
/**
 * Displays a form used for editing or adding a product to database.
 *
 * @param string $error Error message from the manage_products form.
 * @param bool $related_to_release If true then we are passing from adding a release in general so we set the relation to this automatically
 * @return void
 */
function ribcage_edit_product_form($error = 0, $related_to_release = 0)
{
    global $artist;
    global $release, $releases;
    global $product;
    if (isset($_REQUEST['product'])) {
        $product = get_product($_REQUEST['product']);
    }
    $releases = list_recent_releases_blurb();
    if ($error) {
        echo '<div id="message" class="error"><p><strong>' . $error . '</strong></p></div>';
    }
    ?>
	<div class="wrap">
		<div id="icon-options-general" class="icon32"><br /></div>
		<?php 
    if (isset($_REQUEST['product'])) {
        ?>
		<h2>Editing <?php 
        product_name();
        ?>
</h2>
		<form action="<?php 
        echo home_url();
        ?>
/wp-admin/admin.php?page=manage_products&product=<?php 
        product_id();
        ?>
&ribcage_action=edited" method="post" id="ribcage_edit_artist" name="edit_artist">
		<?php 
    } else {
        ?>
		<h2>Add A Product</h2>
		<form action="<?php 
        echo home_url();
        ?>
/wp-admin/admin.php?page=manage_products&ribcage_action=add" method="post" id="ribcage_edit_artist" name="edit_artist">
		<?php 
    }
    ?>
				<table class="form-table">             
					<tr valign="top">
						<th scope="row"><label for="product_name">Name</label></th> 
						<td>
							<input type="text" value="<?php 
    product_name();
    ?>
" name="product_name" id="product_name" class="regular-text"/>												
						</td> 
					</tr>
					<tr valign="top">
						<th scope="row"><label for="product_name">Price</label></th> 
						<td>
							<input type="text" value="<?php 
    echo $product['product_cost'];
    ?>
" name="product_cost" id="product_cost" class="regular-text"/>												
						</td> 
					</tr>
					<tr valign="top">
						<th scope="row"><label for="product_related_release">Related To Release</label></th> 
						<td>
							<select name="product_related_release" id="product_related_release">
								<option value = "">None</option>
								<?php 
    while (have_releases()) {
        the_release();
        ?>
								<?php 
        $artist['artist_name'] = get_artistname_by_id($release['release_artist']);
        ?>
								<?php 
        if ($release['release_id'] == $product['product_related_release']) {
            ?>
								<option selected value="<?php 
            release_id();
            ?>
"><?php 
            artist_name();
            ?>
 - <?php 
            release_title();
            ?>
</option>
								<?php 
        } else {
            ?>
								<option value="<?php 
            release_id();
            ?>
"><?php 
            artist_name();
            ?>
 - <?php 
            release_title();
            ?>
</option>
								<?php 
        }
        ?>
								<?php 
    }
    ?>
							</select>												
						</td> 
					</tr>
					<tr valign="top">
						<th scope="row"><label for="product_name">Product Description</label></th> 
						<td>
							<textarea rows="10" cols="100" name="product_description" id="product_description" class="regular-text"><?php 
    product_description();
    ?>
</textarea>					
						</td> 
					</tr>
				</table>
				<p class="submit">
					<input type="submit" name="Submit" class="button-primary" value="Save Changes" />
				</p>
		</form>
</div>
	<?php 
}