Support » Plugins » Hacks » Delete custom field

  • Hi,

    I have multiple custom fields named Awards in the following format I use the below code to create a little gallery. I would like to use the <span class='delete'><a href=".'#'." title='Delete!' />[x]</span> to delete each individual image. I m not sure how to do this. Can anybody help?

    <?php $awds = get_post_meta($post->ID, "Awards", false); ?>
    			<?php foreach($awds as $awd) {
    				  $tawd = explode("&", "$awd");
    				  $tawdd = $tawd[0];
    				  $tawddd = $tawd[1];
    				  echo '<a href="'.$tawdd.'">'.'<img width="200" src="'.$tawddd.'" alt="alt"/>'.'</a>';
    				  echo "<span class='delete'><a href=".'#'." title='Delete!' />[x]</span>";
    		<?php } ?>
Viewing 1 replies (of 1 total)
  • I created a new page

    Template Name: Delimg
    if($_GET['id'] != ""){
    $img = $_GET['id'];
    echo $img;
    delete_post_meta(?, 'Awards', '?');

    and modified the delete link.

    echo "<span class='delete'>" . "<a href='".$tawdd."'>[x]</a>" . "</span>";

    But I’m still not sure how to get the right custom field.

Viewing 1 replies (of 1 total)
  • The topic ‘Delete custom field’ is closed to new replies.