Ejemplo n.º 1
0
function z_edit_texonomy_field($taxonomy)
{
    if (get_bloginfo('version') >= 3.5) {
        wp_enqueue_media();
    } else {
        wp_enqueue_style('thickbox');
        wp_enqueue_script('thickbox');
    }
    if (z_taxonomy_image_url($taxonomy->term_id, NULL, TRUE) == Z_IMAGE_PLACEHOLDER) {
        $image_text = "";
    } else {
        $image_text = z_taxonomy_image_url($taxonomy->term_id, NULL, TRUE);
    }
    echo '<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_image">' . __('Image', 'zci') . '</label></th>
		<td><img class="taxonomy-image" src="' . z_taxonomy_image_url($taxonomy->term_id, NULL, TRUE) . '"/><br/><input type="text" name="taxonomy_image" id="taxonomy_image" value="' . $image_text . '" /><br />
		<button class="z_upload_image_button button">' . __('Upload/Add image', 'zci') . '</button>
		<button class="z_remove_image_button button">' . __('Remove image', 'zci') . '</button>
		</td>
	</tr>' . z_script();
}
function z_edit_texonomy_field($taxonomy)
{
    if (get_bloginfo('version') >= 3.5) {
        wp_enqueue_media();
    } else {
        wp_enqueue_style('thickbox');
        wp_enqueue_script('thickbox');
    }
    echo '<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_image">' . __('Image 1', 'zci') . '</label></th>
		<td><img class="taxonomy-image" src="' . z_taxonomy_image_url($taxonomy->term_id, 1, NULL, TRUE) . '"/><br/><input type="text" name="taxonomy_image" id="taxonomy_image" value="' . get_z_edit_image_url($taxonomy, 1) . '" /><br />
		<button class="z_upload_image_button button">' . __('Upload/Add image', 'zci') . '</button>
		<button class="z_remove_image_button button">' . __('Remove image', 'zci') . '</button>
		</td>
	</tr>
	<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_image">' . __('Image 2', 'zci') . '</label></th>
		<td><img class="taxonomy-image" src="' . z_taxonomy_image_url($taxonomy->term_id, 2, NULL, TRUE) . '"/><br/><input type="text" name="taxonomy_image_2" id="taxonomy_image_2" value="' . get_z_edit_image_url($taxonomy, 2) . '" /><br />

		</td>
	</tr>
	<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_image">' . __('Image 3', 'zci') . '</label></th>
		<td><img class="taxonomy-image" src="' . z_taxonomy_image_url($taxonomy->term_id, 3, NULL, TRUE) . '"/><br/><input type="text" name="taxonomy_image_3" id="taxonomy_image_3" value="' . get_z_edit_image_url($taxonomy, 3) . '" /><br />

		</td>
	</tr>
	<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_image">' . __('Image 4', 'zci') . '</label></th>
		<td><img class="taxonomy-image" src="' . z_taxonomy_image_url($taxonomy->term_id, 4, NULL, TRUE) . '"/><br/><input type="text" name="taxonomy_image_4" id="taxonomy_image_4" value="' . get_z_edit_image_url($taxonomy, 4) . '" /><br />

		</td>
	</tr>
	' . z_script("taxonomy_image");
}
function z_edit_texonomy_field($taxonomy)
{
    if (get_bloginfo('version') >= 3.5) {
        wp_enqueue_media();
    } else {
        wp_enqueue_style('thickbox');
        wp_enqueue_script('thickbox');
    }
    // TODO
    if (z_taxonomy_link_url($taxonomy->term_id, NULL, TRUE) == Z_IMAGE_PLACEHOLDER) {
        $link_text = "";
    } else {
        $link_text = z_taxonomy_link_url($taxonomy->term_id, NULL, TRUE);
    }
    echo '<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_link">' . __('Link', 'zci') . '</label></th>
		<td>
		<br/>
		<input type="text" name="taxonomy_link" id="taxonomy_link" value="' . $link_text . '" placeholder="http://www.example.com/" />
		<p id="taxonomy_link_error" class="hidden error">Invalid URL</p>
		<p class="description">Enter a URL to add a link to the category.</p>
		</td>
	</tr>';
    // echo validate_url();
    if (z_taxonomy_image_url($taxonomy->term_id, NULL, TRUE) == Z_IMAGE_PLACEHOLDER) {
        $image_text = "";
    } else {
        $image_text = z_taxonomy_image_url($taxonomy->term_id, NULL, TRUE);
    }
    echo '<tr class="form-field">
		<th scope="row" valign="top"><label for="taxonomy_image">' . __('Image', 'zci') . '</label></th>
		<td><img class="taxonomy-image" src="' . z_taxonomy_image_url($taxonomy->term_id, NULL, TRUE) . '"/><br/><input type="text" name="taxonomy_image" id="taxonomy_image" value="' . $image_text . '" /><br />
		<button class="z_upload_image_button button">' . __('Upload/Add image', 'zci') . '</button>
		<button class="z_remove_image_button button">' . __('Remove image', 'zci') . '</button>
		<p class="description">Add an image to add to the category.</p>
		</td>
	</tr>' . z_script();
}