Пример #1
0
/**
 * Create callbacks for custom columns.
 *
 * @since Quality Control 0.1
 * @uses get_the_term_list
 */
function quality_manage_columns($column)
{
    global $post;
    switch ($column) {
        case 'milestone':
            $milestones = get_the_terms($post->ID, 'ticket_milestone');
            if (!empty($milestones)) {
                $out = array();
                foreach ($milestones as $c) {
                    $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;ticket_milestone={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'ticket_milestone', 'display')) . "</a>";
                }
                echo join(', ', $out);
            } else {
                _e('No Milestone', 'quality');
            }
            break;
        case 'status':
            $states = get_the_terms($post->ID, 'ticket_status');
            if (!empty($states)) {
                $out = array();
                foreach ($states as $c) {
                    $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;ticket_status={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'ticket_milestone', 'display')) . "</a>";
                }
                echo join(', ', $out);
            } else {
                _e('No Status', 'quality');
            }
            break;
        case 'assigned':
            echo quality_assigned_to_list();
            break;
    }
}
Пример #2
0
function my_manage_project_columns($column, $post_id)
{
    global $post;
    switch ($column) {
        case 'type':
            $terms = get_the_terms($post_id, 'type');
            if (!empty($terms)) {
                $out = array();
                foreach ($terms as $term) {
                    $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'type' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'type', 'display')));
                }
                echo join(', ', $out);
            } else {
                _e('No Type Specified');
            }
            break;
        case 'featured':
            $featured = get_field('status', $post_id);
            if ($featured != 'no') {
                echo '<span class="yes">YES</span>';
            } else {
                echo '<span class="no">NO</span>';
            }
            break;
        default:
            break;
    }
}
Пример #3
0
function manage_events_columns($name)
{
    global $post, $wp_query, $default_date;
    switch ($name) {
        case 'events_cat':
            $terms = get_the_terms($post->ID, 'events_cat');
            //If the terms array contains items... (dupe of core)
            if (!empty($terms)) {
                //Loop through terms
                foreach ($terms as $term) {
                    //Add tax name & link to an array
                    $post_terms[] = esc_html(sanitize_term_field('name', $term->name, $term->term_id, '', 'edit'));
                }
                //Spit out the array as CSV
                echo implode(', ', $post_terms);
            } else {
                //Text to show if no terms attached for post & tax
                echo '<em>No terms</em>';
            }
            break;
        case 'eventdate':
            if (get_post_meta(get_the_ID(), 'event_date', true) != '') {
                echo date($default_date, get_post_meta(get_the_ID(), 'event_date', true));
            }
            //echo get_post_meta( get_the_ID(),'event_date',TRUE );
            break;
        case 'location':
            echo get_post_meta(get_the_ID(), 'event_location', TRUE);
            break;
        case 'venue':
            echo get_post_meta(get_the_ID(), 'event_venue', TRUE);
            break;
    }
}
Пример #4
0
function manage_portfolio_columns($column)
{
    global $post;
    if ($post->post_type == "portfolio") {
        switch ($column) {
            case "description":
                the_excerpt();
                break;
            case "portfolio_categories":
                $terms = get_the_terms($post->ID, 'portfolio_category');
                if (!empty($terms)) {
                    foreach ($terms as $t) {
                        $output[] = "<a href='edit.php?post_type=portfolio&portfolio_tag={$t->slug}'> " . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'portfolio_tag', 'display')) . "</a>";
                    }
                    $output = implode(', ', $output);
                } else {
                    $t = get_taxonomy('portfolio_category');
                    $output = "No {$t->label}";
                }
                echo $output;
                break;
            case 'thumbnail':
                echo the_post_thumbnail('thumbnail');
                break;
        }
    }
}
Пример #5
0
function orbit_manage_excpt2_columns($column, $post_id)
{
    global $post;
    switch ($column) {
        // If displaying the 'type' column
        case 'type':
            // Get the types for the post
            $terms = get_the_terms($post_id, 'excpt2-type');
            // If terms were found
            if (!empty($terms)) {
                $out = array();
                // Loop through each term, linking to the 'edit posts' page for the specific term
                foreach ($terms as $term) {
                    $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'excpt2' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'excpt2', 'display')));
                }
                // Join the terms, separating them with a comma
                echo join(', ', $out);
            } else {
                _e('No excpt2 type');
            }
            break;
            // Just break out of the switch statement for everything else
        // Just break out of the switch statement for everything else
        default:
            break;
    }
}
Пример #6
0
function get_the_series_rss($type = 'rss')
{
    $series = get_the_series();
    $home = get_bloginfo_rss('home');
    $the_list = '';
    $series_names = array();
    $filter = 'rss';
    if ('atom' == $type) {
        $filter = 'raw';
    }
    if (!empty($series)) {
        foreach ((array) $series as $serial) {
            $series_names[] = sanitize_term_field('name', $serial->name, $serial->term_id, 'series', $filter);
        }
    }
    $series_names = array_unique($series_names);
    foreach ($series_names as $series_name) {
        if ('rdf' == $type) {
            $the_list .= "\n\t\t<series:name><![CDATA[{$series_name}]]></series:name>\n";
        } elseif ('atom' == $type) {
            $the_list .= sprintf('<series:name scheme="%1$s" term="%2$s" />', esc_attr(apply_filters('get_bloginfo_rss', get_bloginfo('url'))), esc_attr($series_name));
        } else {
            $the_list .= "\n\t\t<series:name><![CDATA[{$series_name}]]></series:name>\n";
        }
    }
    return apply_filters('the_series_rss', $the_list, $type);
}
Пример #7
0
function manage_artists_columns($name)
{
    global $wpdb, $wp_query, $post;
    switch ($name) {
        case 'genres':
            echo get_post_meta(get_the_ID(), 'artist_genres', TRUE);
            break;
        case 'artist_id':
            echo get_the_ID();
            break;
        case 'artist_cat':
            $terms = get_the_terms($post->ID, 'artist_cat');
            //If the terms array contains items... (dupe of core)
            if (!empty($terms)) {
                //Loop through terms
                foreach ($terms as $term) {
                    //Add tax name & link to an array
                    $post_terms[] = esc_html(sanitize_term_field('name', $term->name, $term->term_id, '', 'edit'));
                }
                //Spit out the array as CSV
                echo implode(', ', $post_terms);
            } else {
                //Text to show if no terms attached for post & tax
                echo '<em>No terms</em>';
            }
            break;
        case 'thumbnail':
            echo the_post_thumbnail(array(100, 100));
            break;
    }
}
Пример #8
0
function vntd_portfolio_columns_content($column, $post_id)
{
    global $post;
    switch ($column) {
        /* If displaying the 'duration' column. */
        case 'category':
            $taxonomy = "project-type";
            $post_type = get_post_type($post_id);
            $terms = get_the_terms($post_id, $taxonomy);
            if (!empty($terms)) {
                foreach ($terms as $term) {
                    $post_terms[] = "<a href='edit.php?post_type={$post_type}&{$taxonomy}={$term->slug}'> " . esc_html(sanitize_term_field('name', $term->name, $term->term_id, $taxonomy, 'edit')) . "</a>";
                }
                echo join(', ', $post_terms);
            } else {
                echo '<i>No categories.</i>';
            }
            break;
            /* If displaying the 'genre' column. */
        /* If displaying the 'genre' column. */
        case 'thumbnail':
            the_post_thumbnail('thumbnail', array('class' => 'column-img'));
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
}
Пример #9
0
 /**
  * This function takes an object's information and creates a term object.
  *
  * As of version 1.2, you can hook into the 'term_description' or
  * '{$taxonomy}_description' filter to add a description to your terms.
  *
  * The variable type (object or array) for the returned $term will match the set type of the passed $object.
  *
  * @since 1.0
  * @uses $cpt_onomies_manager
  * @param array|object $object - the information for the object you are converting
  * @param boolean $get_count - whether to get the term count
  * @return array|object - the information for the term you have created.
  */
 private function convert_object_to_cpt_onomy_term($object, $get_count = true)
 {
     global $cpt_onomies_manager;
     // If its empty, then there's no point
     if (empty($object)) {
         return $object;
     }
     // Make sure the term is an object
     $term = (object) $object;
     // Make sure its a CPT-onomy
     if (!$cpt_onomies_manager->is_registered_cpt_onomy($term->post_type)) {
         return $object;
     }
     /**
      * sanitize_term_field() lets you apply the 'term_description'
      * or '{$taxonomy}_description' filter to tweak the description,
      * if desired. Maybe you want the description to be a custom field?
      * or the post content. Just return that info in the filter!
      */
     $term = array('term_id' => $term->ID, 'name' => apply_filters('the_title', $term->post_title, $term->ID), 'slug' => $term->post_name, 'term_group' => $term->post_parent, 'term_taxonomy_id' => 0, 'taxonomy' => $term->post_type, 'description' => sanitize_term_field('description', '', $term->ID, $term->post_type, 'display'), 'parent' => $term->post_parent);
     if ($get_count) {
         $term['count'] = $this->get_term_count($term['term_id'], $term['taxonomy']);
     }
     if (is_object($object)) {
         return (object) $term;
     }
     return $term;
 }
Пример #10
0
 /**
  * Portfolio Custom Columns
  * @since     1.0
  * @updated   1.0
  *
  */
 public function portfolio_custom_columns($column)
 {
     global $post;
     $layouts = array('half' => esc_attr__('Half Width', 'Twoot'), 'full' => esc_attr__('Full Width', 'Twoot'));
     $type = ucwords(twoot_get_frontend_func('meta', 'type'));
     $layout = twoot_get_frontend_func('meta', 'layout');
     switch ($column) {
         case 'portfolio_categories':
             $terms = get_the_terms($post->ID, 'portfolio_cat');
             if (!empty($terms)) {
                 foreach ($terms as $t) {
                     $output[] = '<a href="edit.php?post_type=portfolio&portfolio_cat=' . $t->slug . '">' . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'portfolio_cat', 'display')) . '</a>';
                 }
                 $output = implode(', ', $output);
             } else {
                 $t = get_taxonomy('portfolio_cat');
                 $output = 'No ' . $t->label;
             }
             echo $output;
             break;
         case 'portfolio_thumbnail':
             if (has_post_thumbnail()) {
                 the_post_thumbnail('thumbnail');
             } else {
                 echo esc_attr__('No featured image', 'Twoot');
             }
             break;
         case 'portfolio_type':
             echo $type;
             break;
         case 'portfolio_layout':
             echo $layouts[$layout];
             break;
     }
 }
/**
 * UCFBands Rehearsal: Manage CPT Custom Columns
 *
 * @author Jordan Pakrosnis
 */
function manage_rehearsal_columns($column, $post_id)
{
    global $post;
    switch ($column) {
        /* If displaying the 'duration' column. */
        case 'rehearsal_date':
            // Edit link
            echo '<a href="' . get_edit_post_link() . '">';
            /* Get the post meta. */
            $rehearsal_date = get_post_meta($post_id, '_ucfbands_rehearsal_' . 'date', true);
            /* If no date is found, output a default message. */
            if (empty($rehearsal_date)) {
                echo __('Not Set!');
            } else {
                echo date('l, M jS', $rehearsal_date);
            }
            // End edit link
            echo '</a>';
            break;
            /* If displaying the 'cancelled' column. */
        /* If displaying the 'cancelled' column. */
        case 'cancelled':
            /* Get the post meta. */
            $rehearsal_cancelled = get_post_meta($post_id, '_ucfbands_rehearsal_' . 'is_rehearsal_cancelled', true);
            /* If no date is found, output a default message. */
            if ($rehearsal_cancelled == true) {
                echo '<b>Yes</b>';
            }
            break;
            /* If displaying the 'band' column. */
        /* If displaying the 'band' column. */
        case 'band':
            /* Get the genres for the post. */
            $terms = get_the_terms($post_id, 'band');
            /* If terms were found. */
            if (!empty($terms)) {
                $out = array();
                /* Loop through each term, linking to the 'edit posts' page for the specific term. */
                foreach ($terms as $term) {
                    $out[] = sprintf('%s', esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'band', 'display')));
                }
                /* Join the terms, separating them with a comma. */
                echo join(', ', $out);
            } else {
                _e('No Band');
            }
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
    // column switch
}
/**
 * Add content to the created admin columns for questions
 * @param (string) the column title
 * @param (int) the post ID
 * @return (void / output buffer)
 */
function han_dwa_qa_question_admin_columns_content($column, $postId)
{
    $question = new Question($postId);
    if ($column === 'email') {
        echo $question->getEmail();
    } elseif ($column === 'votes') {
        echo $question->getVotes();
    } elseif ($column === 'qa') {
        $qa = $question->getQa();
        echo sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post' => $qa->ID, 'action' => 'edit'), 'post.php')), esc_html(sanitize_term_field('name', $qa->post_title, $qa->ID, 'name', 'display')));
    }
}
Пример #13
0
function get_portfolio_taxs($cat_name)
{
    global $post;
    $categories = get_the_terms(null, $cat_name);
    if (!empty($categories)) {
        $out = array();
        foreach ($categories as $c) {
            $out[] = "<a href='edit.php?post_type={$post->post_type}&amp;{$cat_name}={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, $cat_name, 'display')) . "</a>";
        }
        return join(', ', $out);
    } else {
        return $cat_name == 'projects' ? __('Uncategorized') : __('No Tags');
    }
}
Пример #14
0
function organizedthemes_manage_staff_columns($column, $post_id)
{
    global $post;
    switch ($column) {
        case "slide_thumbnail":
            //Adds the slide thumnail to the columns
            $width = (int) 400;
            $height = (int) 300;
            $thumbnail_id = get_post_meta($post_id, '_thumbnail_id', true);
            // Display the featured image in the column view if possible
            if ($thumbnail_id) {
                $thumb = wp_get_attachment_image($thumbnail_id, array($width, $height), true);
            }
            break;
            /* If displaying the 'job title' column. */
        /* If displaying the 'job title' column. */
        case 'staff_title':
            /* Get the post meta. */
            $job_title = get_post_meta($post_id, 'title', true);
            /* If no duration is found, output a default message. */
            if (empty($job_title)) {
                echo __('', 'organizedthemes');
            } else {
                printf(__('%s'), $job_title);
            }
            break;
            /* If displaying the 'staff-group' column. */
        /* If displaying the 'staff-group' column. */
        case 'staff_group':
            /* Get the genres for the post. */
            $terms = get_the_terms($post_id, 'staff-group');
            /* If terms were found. */
            if (!empty($terms)) {
                $out = array();
                /* Loop through each term, linking to the 'edit posts' page for the specific term. */
                foreach ($terms as $term) {
                    $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'staff-group' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'staff-group', 'display')));
                }
                /* Join the terms, separating them with a comma. */
                echo join(', ', $out);
            } else {
                _e('');
            }
            break;
            /* Just break out of the switch statement for everything else. */
        /* Just break out of the switch statement for everything else. */
        default:
            break;
    }
}
Пример #15
0
 public function docCustomColumn($columnName, $postID)
 {
     $taxonomy = $columnName;
     $postType = get_post_type($postID);
     $terms = get_the_terms($postID, $taxonomy);
     if (!empty($terms)) {
         foreach ($terms as $term) {
             $postTerms[] = "<a href='edit.php?post_type={$postType}&{$taxonomy}={$term->slug}'> " . esc_html(sanitize_term_field('name', $term->name, $term->term_id, $taxonomy, 'edit')) . '</a>';
             echo join(',', $postTerms);
         }
     } else {
         echo '<i>No terms.</i>';
     }
 }
Пример #16
0
 function recipe_hero_manage_recipe_columns($column, $post_id)
 {
     global $post;
     switch ($column) {
         case 'id':
             echo $post_id;
             break;
         case 'photo':
             if (has_post_thumbnail()) {
                 echo get_the_post_thumbnail($post_id, 'rh-admin-column');
             }
             break;
         case 'course':
             $terms = get_the_terms($post_id, 'course');
             if (!empty($terms)) {
                 $out = array();
                 foreach ($terms as $term) {
                     $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'course' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'course', 'display')));
                 }
                 echo join(', ', $out);
             } else {
                 _e('No Courses', 'recipe-hero');
             }
             break;
         case 'cuisine':
             $terms = get_the_terms($post_id, 'cuisine');
             if (!empty($terms)) {
                 $out = array();
                 foreach ($terms as $term) {
                     $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'cuisine' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'cuisine', 'display')));
                 }
                 echo join(', ', $out);
             } else {
                 _e('No Cuisines', 'recipe-hero');
             }
             break;
         case 'ingredients':
             $ingredients = get_post_meta($post->ID, '_recipe_hero_ingredients_group', true);
             foreach ((array) $ingredients as $key => $ingredient) {
                 $ingredient_name = '';
                 if (isset($ingredient['name'])) {
                     $ingredient_name = $ingredient['name'];
                 }
                 echo $ingredient_name . '<br />';
             }
             break;
         default:
             break;
     }
 }
 function column_content($column, $post_id)
 {
     if ($column != $this->column_name) {
         return;
     }
     $terms = get_the_terms($post_id, $this->taxonomy->name);
     if (!empty($terms)) {
         $out = array();
         foreach ($terms as $c) {
             $url = add_query_arg(array('post_type' => get_current_screen()->post_type, $this->taxonomy->query_var => $c->slug), 'edit.php');
             $out[] = html('a', array('href' => $url), esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'tag', 'display')));
         }
         echo implode(', ', $out);
     }
 }
 /**
  * 
  * @callback        filter      cell_ + post type slug + column name
  * @return          string
  */
 public function cell_amazon_auto_links_amazon_auto_links_tag($sCell, $iPostID)
 {
     // Get the genres for the post.
     $_aTerms = get_the_terms($iPostID, AmazonAutoLinks_Registry::$aTaxonomies['tag']);
     // If no tag is assigned to the post,
     if (empty($_aTerms)) {
         return '—';
     }
     // Loop through each term, linking to the 'edit posts' page for the specific term.
     $_aOutput = array();
     foreach ($_aTerms as $_oTerm) {
         $_aOutput[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $GLOBALS['post']->post_type, AmazonAutoLinks_Registry::$aTaxonomies['tag'] => $_oTerm->slug), 'edit.php')), esc_html(sanitize_term_field('name', $_oTerm->name, $_oTerm->term_id, AmazonAutoLinks_Registry::$aTaxonomies['tag'], 'display')));
     }
     // Join the terms, separating them with a comma.
     return join(', ', $_aOutput);
 }
 /**
  * Display tags with link for each taxonomy of content type !
  *
  * @param string $column_name 
  * @param integer $post_id 
  * @return void
  * @author Amaury Balmer
  */
 public static function addCustomColumn($column_name, $post_id)
 {
     global $post;
     if (substr($column_name, 0, 6) == 'staxo-') {
         $current_taxo = str_replace('staxo-', '', $column_name);
         $terms = get_the_terms($post_id, $current_taxo);
         if (!empty($terms)) {
             $output = array();
             foreach ($terms as $term) {
                 $output[] = "<a href='edit-tags.php?action=edit&taxonomy=" . $current_taxo . "&post_type=" . $post->post_type . "&tag_ID={$term->term_id}'> " . esc_html(sanitize_term_field('name', $term->name, $term->term_id, $current_taxo, 'display')) . "</a>";
             }
             echo join(', ', $output);
         } else {
             //_e('No term.','simple-case');
         }
     }
 }
Пример #20
0
/**
 * Retrieve all of the post tags, formatted for use in feeds.
 *
 * @credit WordPress /includes/rss-feed.php
 *
 * Since 0.44.0
 */
function nrelate_get_the_tags_rss()
{
    $tags = get_the_tags();
    $tag_names = array();
    $filter = 'rss';
    if (!empty($tags)) {
        foreach ((array) $tags as $tag) {
            $tag_names[$tag->term_id] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);
        }
    }
    $tag_names = array_unique($tag_names);
    $the_tags = '';
    foreach ($tag_names as $tag_id => $tag_name) {
        $the_tags .= "\t\t<tag><![CDATA[" . @html_entity_decode($tag_name, ENT_COMPAT, get_option('blog_charset')) . "]]></tag><tagID>" . $tag_id . "</tagID>\n";
    }
    return $the_tags;
}
Пример #21
0
 function __display_custom_list_columns($column_name, $post_id)
 {
     if ($this->_var != $column_name) {
         return;
     }
     $terms = get_the_terms($post_id, $this->_var);
     if (!empty($terms)) {
         $post_type = get_post_type($post_id);
         $out = array();
         foreach ($terms as $term) {
             $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post_type, $this->_var => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, $this->_var, 'display')));
         }
         echo join(', ', $out);
     } else {
         echo "&nbsp;";
     }
 }
 public function cell_fetch_tweets_fetch_tweets_tag($strCell, $intPostID)
 {
     // Get the genres for the post.
     $arrTerms = get_the_terms($intPostID, FetchTweets_Commons::TagSlug);
     // If no tag is assigned to the post,
     if (empty($arrTerms)) {
         return '—';
     }
     // Variables
     global $post;
     $arrOutput = array();
     // Loop through each term, linking to the 'edit posts' page for the specific term.
     foreach ($arrTerms as $oTerm) {
         $arrOutput[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, FetchTweets_Commons::TagSlug => $oTerm->slug), 'edit.php')), esc_html(sanitize_term_field('name', $oTerm->name, $oTerm->term_id, FetchTweets_Commons::TagSlug, 'display')));
     }
     // Join the terms, separating them with a comma.
     return join(', ', $arrOutput);
 }
function jtsternberg_taxonomy_columns_display($column)
{
    global $post;
    switch ($column) {
        case 'jt-orientation':
            $categories = get_the_terms($post->ID, 'orientation');
            if (!empty($categories)) {
                $out = array();
                foreach ($categories as $c) {
                    $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'orientation' => $c->slug), 'edit.php')), esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')));
                }
                echo join(', ', $out);
            } else {
                _e('No Orientation Specified');
            }
            break;
    }
}
function pages_columns_content($column_name, $post_ID)
{
    global $post;
    if ($column_name == 'pages') {
        $terms = get_the_terms($post_ID, 'pages');
        /* If terms were found. */
        if (!empty($terms)) {
            $out = array();
            /* Loop through each term, linking to the 'edit posts' page for the specific term. */
            foreach ($terms as $term) {
                $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'pages' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'pages', 'display')));
            }
            /* Join the terms, separating them with a comma. */
            echo join(', ', $out);
        } else {
            _e('No Pages');
        }
    }
}
function eventorganiser_event_fill_columns($column_name, $id)
{
    global $post;
    $series_id = empty($post->event_id) ? $id : '';
    $phpFormat = 'M, jS Y';
    if (!eo_is_all_day($series_id)) {
        $phpFormat .= '\\<\\/\\b\\r\\>' . get_option('time_format');
    }
    switch ($column_name) {
        case 'venue':
            $terms = get_the_terms($post->ID, 'event-venue');
            if (!empty($terms)) {
                foreach ($terms as $term) {
                    $post_terms[] = "<a href='" . add_query_arg('event-venue', $term->slug) . "'>" . esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'event-venue', 'display')) . "</a>";
                }
                echo join(', ', $post_terms);
                echo "<input type='hidden' value='" . $term->term_id . "'/>";
            }
            break;
        case 'datestart':
            eo_the_start($phpFormat, $series_id);
            break;
        case 'dateend':
            eo_the_end($phpFormat, $series_id);
            break;
        case 'reoccurence':
            eo_display_reoccurence($series_id);
            break;
        case 'eventcategories':
            $terms = get_the_terms($post->ID, 'event-category');
            if (!empty($terms)) {
                foreach ($terms as $term) {
                    $post_terms[] = "<a href='" . add_query_arg('event-category', $term->slug) . "'>" . esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'event-category', 'display')) . "</a>";
                }
                echo join(', ', $post_terms);
            }
            break;
        default:
            break;
    }
    // end switch
}
 function fill_meta_keywords_columns($column_name, $id)
 {
     switch ($column_name) {
         case 'keywords':
             $admin = get_admin_url();
             $string = "edit.php?post_type=page&";
             $tags = get_the_terms($id, 'keywords');
             if (!empty($tags)) {
                 $out = array();
                 foreach ($tags as $tag) {
                     $out[] = "<a href='" . $string . "keywords={$tag->slug}'> " . esc_html(sanitize_term_field('name', $tag->name, $tag->term_id, 'keywords', 'display')) . "</a>";
                 }
                 echo join(', ', $out);
             } else {
                 _e('No Keywords');
             }
             break;
         default:
             break;
     }
 }
Пример #27
0
function manage_faq_columns($column)
{
    global $post;
    if ($post->post_type == "faq") {
        switch ($column) {
            case "faq_categories":
                $terms = get_the_terms($post->ID, 'faq_category');
                if (!empty($terms)) {
                    foreach ($terms as $t) {
                        $output[] = "<a href='edit.php?post_type=faq&faq_tag={$t->slug}'> " . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'faq_tag', 'display')) . "</a>";
                    }
                    $output = implode(', ', $output);
                } else {
                    $t = get_taxonomy('faq_category');
                    $output = "No {$t->label}";
                }
                echo $output;
                break;
        }
    }
}
 function wipMediaCategories_fillColumn($column_name, $id)
 {
     switch ($column_name) {
         case 'media_categories':
             $admin = get_admin_url();
             $string = "upload.php?";
             $tags = get_the_terms($id, 'media_category');
             if (!empty($tags)) {
                 $out = array();
                 foreach ($tags as $tag) {
                     $out[] = "<a href='" . $string . "media_category={$tag->slug}'> " . esc_html(sanitize_term_field('name', $tag->name, $tag->term_id, 'media_category', 'display')) . "</a>";
                 }
                 echo join(', ', $out);
             } else {
                 _e('No Categories');
             }
             break;
         default:
             break;
     }
 }
Пример #29
0
function slide_columns_display($slide_columns, $post_id)
{
    switch ($slide_columns) {
        // Code from: http://wpengineer.com/display-post-thumbnail-post-page-overview
        case "slide_thumbnail":
            //Adds the slide thumnail to the columns
            $width = (int) 400;
            $height = (int) 300;
            $thumbnail_id = get_post_meta($post_id, '_thumbnail_id', true);
            // Display the featured image in the column view if possible
            if ($thumbnail_id) {
                $thumb = wp_get_attachment_image($thumbnail_id, array($width, $height), true);
            }
            if (isset($thumb)) {
                echo $thumb;
            } else {
                $custom = get_post_custom();
                echo $custom["slide_video"][0];
            }
            break;
            /* If displaying the 'slide-group' column. */
        /* If displaying the 'slide-group' column. */
        case 'slide_group':
            /* Get the genres for the post. */
            $terms = get_the_terms($post_id, 'slide-group');
            /* If terms were found. */
            if (!empty($terms)) {
                $out = array();
                /* Loop through each term, linking to the 'edit posts' page for the specific term. */
                foreach ($terms as $term) {
                    $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'slide-group' => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, 'slide-group', 'display')));
                }
                /* Join the terms, separating them with a comma. */
                echo join(', ', $out);
            } else {
                _e('');
            }
            break;
    }
}
Пример #30
0
function manage_aps_columns($column, $post_id)
{
    global $post;
    $taxonomies = get_object_taxonomies('aps');
    //echo "<pre>"; print_r($taxonomies); echo "</pre>";
    if (in_array($column, $taxonomies)) {
        /* Get the terms for the post. */
        $terms = get_the_terms($post_id, $column);
        /* If terms were found. */
        if (!empty($terms)) {
            $out = array();
            /* Loop through each term, linking to the 'edit posts' page for the specific term. */
            foreach ($terms as $term) {
                $out[] = sprintf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, $column => $term->slug), 'edit.php')), esc_html(sanitize_term_field('name', $term->name, $term->term_id, $column, 'display')));
            }
            /* Join the terms, separating them with a comma. */
            echo join(', ', $out);
        } else {
            _e('Nenhum');
        }
    }
}