Пример #1
0
 function cpotheme_taxonomy_meta_fields($title, $post, $cpo_metadata)
 {
     if ($cpo_metadata == null || sizeof($cpo_metadata) == 0) {
         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 ($field_type == 'text') {
             $output .= cpotheme_form_text($field_name, $field_value, $current_meta);
         } elseif ($field_type == 'textarea') {
             $output .= cpotheme_form_textarea($field_name, $field_value, $current_meta);
         } elseif ($field_type == 'select') {
             $output .= cpotheme_form_select($field_name, $field_value, $current_meta['option'], $current_meta);
         } elseif ($field_type == 'checkbox') {
             $output .= cpotheme_form_checkbox($field_name, $field_value, $current_meta);
         } elseif ($field_type == 'yesno') {
             $output .= cpotheme_form_yesno($field_name, $field_value, $current_meta);
         } elseif ($field_type == 'color') {
             $output .= cpotheme_form_color($field_name, $field_value);
         } elseif ($field_type == 'imagelist') {
             $output .= cpotheme_form_imagelist($field_name, $field_value, $current_meta['option'], $current_meta);
         } elseif ($field_type == 'upload') {
             $output .= cpotheme_form_upload($field_name, $field_value, null, $post);
         } elseif ($field_type == 'date') {
             $output .= cpotheme_form_date($field_name, $field_value, null);
         }
         //Separators
         if ($field_type != 'separator' && $field_type != 'divider') {
             $output .= '<br><span class="description">' . $field_desc . '</span>';
             $output .= '</td>';
             $output .= '</tr>';
         }
     }
     $output .= '</tbody>';
     $output .= '</table>';
     return $output;
 }
Пример #2
0
function cpotheme_get_sidebar_position()
{
    $current_id = cpotheme_current_id();
    if (is_tax() || is_category() || is_tag()) {
        $sidebar_layout = cpotheme_tax_meta($current_id, 'layout_sidebar');
    } else {
        $sidebar_layout = get_post_meta($current_id, 'layout_sidebar', true);
    }
    if ($sidebar_layout == '') {
        $sidebar_layout = 'right';
    }
    return $sidebar_layout;
}
Пример #3
0
 function cpotheme_header_slider()
 {
     if (function_exists('putRevSlider')) {
         $current_id = cpotheme_current_id();
         if (is_tax() || is_category() || is_tag()) {
             $page_slider = cpotheme_tax_meta($current_id, 'page_slider');
         } else {
             $page_slider = get_post_meta($current_id, 'page_slider', true);
         }
         if ($page_slider != '0' && $page_slider != '') {
             echo '<div id="revslider" class="revslider">';
             putRevSlider($page_slider);
             echo '</div>';
         }
     }
 }