????JFIF??x?x????'
| Server IP : 104.21.30.238 / Your IP : 216.73.216.145 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /././proc/self/root/home/tempvsty/eaabusiness.com/wp-content/themes/allegiant/core/ |
Upload File : |
<?php
//Create the metadata fields for the metadata form.
if ( ! function_exists( 'cpotheme_taxonomy_meta_fields' ) ) {
function cpotheme_taxonomy_meta_fields( $title, $post, $cpo_metadata ) {
if ( null == $cpo_metadata || 0 == sizeof( $cpo_metadata ) ) {
return;
}
$post_id = isset( $_GET['tag_ID'] ) ? $_GET['tag_ID'] : false;
$output = '';
$field_prefix = 'cpotheme_taxonomy_meta_';
$output .= '<h3>' . $title . '</h3>';
$output .= '<table class="form-table">';
$output .= '<tbody>';
//Loop through all the data taxonomies and create the field associated to them.
foreach ( $cpo_metadata as $current_meta ) {
$field_name = $current_meta['name'];
$field_title = $current_meta['label'];
$field_desc = $current_meta['desc'];
$field_type = $current_meta['type'];
$field_value = cpotheme_tax_meta( $post_id, $field_name );
$output .= '<tr>';
$output .= '<th scope="row"><label for="' . $field_name . '" class="field_title">' . $field_title . '</label></th>';
$output .= '<td>';
// Print metaboxes here. Develop different cases for each type of field.
if ( 'text' == $field_type ) {
$output .= cpotheme_form_text( $field_name, $field_value, $current_meta );
} elseif ( 'select' == $field_type ) {
$output .= cpotheme_form_select( $field_name, $field_value, $current_meta['option'], $current_meta );
} elseif ( 'yesno' == $field_type ) {
$output .= cpotheme_form_yesno( $field_name, $field_value, $current_meta );
} elseif ( 'imagelist' == $field_type ) {
$output .= cpotheme_form_imagelist( $field_name, $field_value, $current_meta['option'], $current_meta );
} elseif ( 'iconlist' == $field_type ) {
$output .= cpotheme_form_iconlist( $field_name, $field_value, $current_meta );
}
//Separators
if ( 'separator' != $field_type && 'divider' != $field_type ) {
$output .= '<br><span class="description">' . $field_desc . '</span>';
$output .= '</td>';
$output .= '</tr>';
}
}
$output .= '</tbody>';
$output .= '</table>';
return $output;
}
}
// Create the form to insert the metadata in the category list.
if ( ! function_exists( 'cpotheme_taxonomy_meta_form' ) ) {
function cpotheme_taxonomy_meta_form( $title, $post, $cpo_metadata = null ) {
$output = '';
//Call the field creator with the needed data.
$output .= cpotheme_taxonomy_meta_fields( $title, $post, $cpo_metadata );
echo $output;
}
}
// Check and save metadata to a given tag_ID and taxonomy
if ( ! function_exists( 'cpotheme_taxonomy_meta_save' ) ) {
function cpotheme_taxonomy_meta_save( $option_fields ) {
$tax_meta = get_option( 'cpotheme_taxonomy' );
$post_id = $_POST['tag_ID'];
//Loop through all fields
foreach ( $option_fields as $current_field ) {
$field_name = $current_field['name'];
if ( isset( $_POST[ $field_name ] ) ) {
$field_value = trim( $_POST[ $field_name ] );
$current_value = '';
$current_value = get_post_meta( $post_id, $field_name, true );
// Add metadata
if ( '' != $field_value ) {
$tax_meta[ $post_id ][ $field_name ] = $field_value;
} // Delete unused metadata
else {
unset( $tax_meta[ $post_id ][ $field_name ] );
}
}
}
// Save metadata to the database and redirect user.
update_option( 'cpotheme_taxonomy', $tax_meta );
}
}
//When a cpo_portfolio_category is deleted we also delete the metadata associated with it.
if ( ! function_exists( 'cpotheme_taxonomy_meta_delete' ) ) {
function cpotheme_taxonomy_meta_delete( $option_fields ) {
$tax_meta = get_option( 'cpotheme_taxonomy' );
$post_id = $_POST['tag_ID'];
if ( $tax_meta && isset( $tax_meta[ $post_id ] ) ) {
unset( $tax_meta[ $post_id ] );
}
update_option( 'cpotheme_taxonomy', $tax_meta );
}
}
// Retrieve metadata field $key from the associated $tag_ID
if ( ! function_exists( 'cpotheme_tax_meta' ) ) {
function cpotheme_tax_meta( $id, $key ) {
$tax_meta = get_option( 'cpotheme_taxonomy' );
if ( $tax_meta && isset( $tax_meta[ $id ][ $key ] ) ) {
return $tax_meta[ $id ][ $key ];
} else {
return false;
}
}
}