$posted_tag ){ if( $k === 't' ) continue; //skip the template $tag = new MTM_Tag_Admin($posted_tag); $mtm_data[] = $tag->to_array(); } } return $mtm_data; } public static function output($meta_tags, $args = array() ){ ?>
'.esc_html__('No tags added yet, click here or on the button below to add one!','meta-tag-manager').'
'; ?>
reference) ? __('Custom Meta Tag','meta-tag-manager') : $tag->reference; ?> context) ? array('all') : $tag->context; echo static::get_contexts_list( $context_value ); ?>
<meta value) ? $tag->value:'...'; ?> type); ?>="" content) ? $tag->content:'...' ?> content="" />
$option ){ $selected_attr = ( (is_array($selected) && in_array($option, $selected)) || $selected == $option ) ? ' selected="selected"':''; if( is_array($option) ){ $html .= ''; $html .= self::output_select_options($option, $selected, false); $html .= ''; }else{ //single option, output value no key if( is_numeric($key) ){ $html .= ''; }else{ $html .= ''; } } } if( !preg_match('/selected="selected"/', $html) && !empty($selected) && $add_selected_option ){ //value not existing, so we add it as an option if( is_array($selected) ){ foreach( $selected as $s ){ $html = '' . $html; } }else{ $html = '' . $html; } } return apply_filters('mtm_builder_output_select_options', $html, $options, $selected, $add_selected_option); } public static function get_contexts_list( $contexts ){ if( empty($contexts) ) return ''; $display_contexts = array(); foreach( self::get_context_options() as $context_label => $context_option ){ if( is_array($context_option) ){ foreach( $context_option as $context_option_label => $context_option_value ) if( in_array($context_option_value, $contexts) ){ $display_contexts[] = $context_option_label; } }else{ if( in_array($context_option, $contexts) ){ $display_contexts[] = $context_label; } } } return apply_filters('mtm_builder_get_contexts_list', implode(', ', $display_contexts), $display_contexts, $contexts); } public static function get_context_options(){ if( !empty(self::$context_options) ) return self::$context_options; $context_options = apply_filters('mtm_builder_context_options_main', array( __('All Pages', 'meta-tag-manager') => 'all', __('Front Page', 'meta-tag-manager') => 'home' )); // Post Types $post_types_label = __('Post Types', 'meta-tag-manager'); foreach( get_post_types(array('public'=>true), 'objects') as $post_type){ $context_options[$post_types_label][$post_type->labels->name] = 'post-type_' . $post_type->name; } // Taxonomies $taxonomies_label = __('Taxonomies', 'meta-tag-manager'); foreach( get_taxonomies(array('public'=>true), 'objects') as $taxonomy ){ $context_options[$taxonomies_label][$taxonomy->labels->name] = 'taxonomy_' . $taxonomy->name; } self::$context_options = apply_filters('mtm_builder_context_options', $context_options); return $context_options; } }