示例#1
0
            global $more;
            $more = 0;
            the_content();
            if (get_terms_meta($catID, 'sponsor1', true)) {
                ?>
                        <strong>
                            Sponsored by:
                        </strong>
                        <ul>
                            <?php 
                echo '<li>' . get_terms_meta($catID, 'sponsor1', true) . '</li>';
                if (get_terms_meta($catID, 'sponsor2', true)) {
                    echo '<li>' . get_terms_meta($catID, 'sponsor2', true) . '</li>';
                }
                if (get_terms_meta($catID, 'sponsor3', true)) {
                    echo '<li>' . get_terms_meta($catID, 'sponsor3', true) . '</li>';
                }
                ?>
                        </ul>
                        <?php 
            }
            ?>
                    </td>
                </tr>
            </table>
            </div>
        <?php 
        }
    }
}
?>
            ?>
" rel="bookmark" title="
                                    <?php 
            echo showAndTitle($postID);
            ?>
                                ">
                                    <?php 
            echo showAndTitle($postID);
            ?>
                                </a>

                                <?php 
            $hostlist = get_terms_meta($catID, 'hosts', true);
            $showHosts = explode(",", $hostlist);
            if (get_terms_meta($catID, 'staff', true)) {
                $stafflist = get_terms_meta($catID, 'staff', true);
                $showStaff = explode(",", $stafflist);
                $showHosts = array_merge($showHosts, $showStaff);
            }
            unset($episodeHosts);
            unset($diff);
            $episodeHosts = [];
            $coAuthors = get_coauthors();
            foreach ($coAuthors as $coAuthor) {
                $episodeHosts[] = get_the_author_meta('id', $coAuthor->ID);
            }
            $diff = array_diff($episodeHosts, $showHosts);
            if ($diff) {
                unset($epGuests);
                $epGuests = [];
                foreach ($diff as $diffAuthor) {
/**
 * Function that display the meta text input.
 *
 * @return void.
 */
function wptm_add_meta_textinput($tag)
{
    global $category, $wp_version, $taxonomy;
    $category_id = '';
    if ($wp_version >= '3.0') {
        $category_id = $tag->term_id;
    } else {
        $category_id = $category;
    }
    $metaList = get_option("wptm_configuration");
    if (is_object($category_id)) {
        $category_id = $category_id->term_id;
    }
    if (!is_null($metaList) && count($metaList) > 0 && $metaList != '') {
        ?>
<div id="categorymeta" class="postbox">
<h3 class='hndle'><span><?php 
        _e('Term meta', 'wp-category-meta');
        ?>
</span></h3>
<div class="inside"><input value="wptm_edit" type="hidden"
	name="wptm_edit" /> <input type="hidden" name="image_field"
	id="image_field" value="" />
<table class="form-table">
<?php 
        foreach ($metaList as $inputName => $inputData) {
            $inputType = '';
            $inputTaxonomy = 'category';
            if (is_array($inputData)) {
                $inputType = $inputData['type'];
                $inputTaxonomy = $inputData['taxonomy'];
            } else {
                $inputType = $inputData;
            }
            // display the input field in 2 cases
            // WP version if < 3.0
            // or WP version > 3.0 and $inputTaxonomy == current taxonomy
            if ($wp_version < '3.0' || $inputTaxonomy == $taxonomy) {
                $inputValue = htmlspecialchars(stripcslashes(get_terms_meta($category_id, $inputName, true)));
                if ($inputType == 'text') {
                    ?>
	<tr>
		<th scope="row" valign="top"><label for="category_nicename"><?php 
                    echo $inputName;
                    ?>
</label></th>
	</tr>
	<tr>
		<td><input value="<?php 
                    echo $inputValue;
                    ?>
" type="text" size="40"
			name="<?php 
                    echo 'wptm_' . $inputName;
                    ?>
" /><br />
			<?php 
                    _e('This additional data is attached to the current term', 'wp-category-meta');
                    ?>
</td>
	</tr>
	<?php 
                } elseif ($inputType == 'textarea') {
                    ?>
	<tr>
		<th scope="row" valign="top"><label for="category_nicename"><?php 
                    echo $inputName;
                    ?>
</label></th>
	</tr>
	<tr>
		<td><textarea name="<?php 
                    echo "wptm_" . $inputName;
                    ?>
" rows="5"
			cols="50" style="width: 97%;"><?php 
                    echo $inputValue;
                    ?>
</textarea> <br />
			<?php 
                    _e('This additional data is attached to the current term', 'wp-category-meta');
                    ?>
</td>
	</tr>
	<?php 
                } elseif ($inputType == 'image') {
                    $current_image_url = get_terms_meta($category_id, $inputName, true);
                    ?>
	<tr>
		<th scope="row" valign="top"><label
			for="<?php 
                    echo "wptm_" . $inputName;
                    ?>
" class="wptm_meta_name_label"><?php 
                    echo $inputName;
                    ?>
</label>
		<div id="<?php 
                    echo "wptm_" . $inputName;
                    ?>
_selected_image"
			class="wptm_selected_image"><?php 
                    if ($current_image_url != '') {
                        echo '<img src="' . $current_image_url . '" width="200px" />';
                    }
                    ?>
		</div>
		</th>
	</tr>
	<tr>
		<td>
		<div name="<?php 
                    echo "wptm_" . $inputName;
                    ?>
_url_display"
			id="<?php 
                    echo "wptm_" . $inputName;
                    ?>
_url_display"
			class="wptm_url_display"><?php 
                    if ($current_image_url != '') {
                        echo $current_image_url;
                    } else {
                        _e('No image selected', 'wp-category-meta');
                    }
                    ?>
		</div>
		<img src="images/media-button-image.gif"
			alt="Add photos from your media" /> <a
			href="media-upload.php?type=image&#038;wptm_send_label=<?php 
                    echo $inputName;
                    ?>
&#038;TB_iframe=1&#038;tab=library&#038;height=500&#038;width=640"
			onclick="image_photo_url_add('<?php 
                    echo "wptm_" . $inputName;
                    ?>
')"
			class="thickbox" title="Add an Image"> <strong><?php 
                    echo _e('Click here to add/change your image', 'wp-category-meta');
                    ?>
</strong>
		</a><br />
		<small> <?php 
                    echo _e('Note: To choose image click the "insert into post" button in the media uploader', 'wp-category-meta');
                    ?>
		</small><br />
		<img src="images/media-button-image.gif" alt="Remove existing image" />
		<a href="#"
			onclick="remove_image_url('<?php 
                    echo "wptm_" . $inputName;
                    ?>
','<?php 
                    _e('No image selected', 'wp-category-meta');
                    ?>
')">
		<strong><?php 
                    _e('Click here to remove the existing image', 'wp-category-meta');
                    ?>
</strong>
		</a><br />
		<input type="hidden" name="<?php 
                    echo "wptm_" . $inputName;
                    ?>
"
			id="<?php 
                    echo "wptm_" . $inputName;
                    ?>
"
			value="<?php 
                    echo $current_image_url;
                    ?>
" />
		</td>
	<tr>
	<?php 
                } elseif ($inputType == 'checkbox') {
                    ?>
    <tr>
        <th scope="row" valign="top"><label for="category_nicename"><?php 
                    echo $inputName;
                    ?>
</label></th>
    </tr>
    <tr>
        <td><input value="checked" type="checkbox" <?php 
                    echo $inputValue ? 'checked="checked" ' : '';
                    ?>
            name="<?php 
                    echo 'wptm_' . $inputName;
                    ?>
" /><br />
            <?php 
                    _e('This additional data is attached to the current term', 'wp-category-meta');
                    ?>
</td>
    </tr>
	<?php 
                }
                // end elseif
            }
            //end foreach
        }
        //end IF
    }
    ?>

</table>
<textarea id="content" name="content" rows="100" cols="10" tabindex="2"
	onfocus="image_url_add()"
	style="width: 1px; height: 1px; padding: 0px; border: none display :   none;"></textarea>
<script type="text/javascript">edCanvas = document.getElementById('content');</script>
</div>
</div>
<?php 
}
        <?php 
$catQuery = $wpdb->get_results("SELECT\n            term_taxonomy.term_id, terms.name\n            FROM wordpress.wp_terms terms\n            JOIN wordpress.wp_term_taxonomy term_taxonomy\n            ON term_taxonomy.term_id = terms.term_id\n            WHERE term_taxonomy.taxonomy = 'category'\n            GROUP BY term_taxonomy.term_id\n            ORDER BY terms.name asc");
?>

            <?php 
foreach ($catQuery as $category) {
    $theCat = get_category($category->term_id);
    if (!get_terms_meta($theCat->cat_ID, 'inactive', true) && get_terms_meta($theCat->cat_ID, 'is_podcast', true)) {
        ?>

                    <div class="catthumb headcontent">
                        <table>
                            <tr>
                                <td>
                                    <img src="<?php 
        echo get_terms_meta($theCat->cat_ID, 'thumbnail', true);
        ?>
" />
                                </td>
                                <td>
                                    <a href="http://csicon.fm/<?php 
        echo $theCat->slug;
        ?>
" rel="bookmark">
                                        <h2>
                                            <?php 
        echo $theCat->name;
        ?>
                                        </h2>
                                    </a>
                                    <div class="mini light">
        the_permalink();
        ?>
" rel="bookmark">
                                            <?php 
        if (!is_category()) {
            echo showAndTitle($post);
        } else {
            echo get_the_title();
        }
        ?>
                                        </a>

                                        <?php 
        if (is_category()) {
            $showHosts = explodedCat($catID, hosts);
            if (get_terms_meta($catID, 'staff', true)) {
                $showStaff = explodedCat($catID, staff);
                $showHosts = array_merge($showHosts, $showStaff);
            }
            unset($episodeHosts);
            unset($diff);
            $episodeHosts = [];
            $coAuthors = get_coauthors();
            foreach ($coAuthors as $coAuthor) {
                $episodeHosts[] = get_the_author_meta('id', $coAuthor->ID);
            }
            $diff = array_diff($episodeHosts, $showHosts);
            if ($diff) {
                unset($epGuests);
                $epGuests = [];
                $epGuests = nameList($diff);
/**
 * Displays a list of all shows belonging to a person, based on the
 * relevant meta string. Then outputs them with a displaystring and
 * links to the various shows.
 * @param  [type] $userID        Takes the User's ID.
 * @param  [type] $catString     Takes the Category ID.
 * @param  [type] $displayString Displaystring to prepend to output.
 * @return [type]                Returns a list of the shows matching the user & meta.
 */
function userShows($userID, $catString, $displayString)
{
    $categoryIDs = get_all_category_ids();
    $author = get_userdata($userID);
    $hostShows = [];
    foreach ($categoryIDs as $catID) {
        $hosts = explodedCat($catID, $catString);
        if (in_array($userID, $hosts)) {
            if (!preg_match('/cancelled/', $displayString) && !get_terms_meta($catID, 'inactive') xor preg_match('/cancelled/', $displayString) && get_terms_meta($catID, 'inactive')) {
                $hostShows[get_cat_name($catID)] = site_URL() . '/' . getCatSlug($catID);
            }
        }
    }
    if ($hostShows) {
        return $author->first_name . "'s " . $displayString . ': ' . andListKeyed($hostShows) . '.<br />';
    }
}
        $subscriptionOptions['RSS'] = get_terms_meta($catID, 'feed', true);
    }
    if (!get_terms_meta($catID, 'feed', true)) {
        $subscriptionOptions['RSS'] = site_URL() . '/' . $category[0]->category_nicename . '/feed/';
    }
    if (get_terms_meta($catID, 'itunes', true)) {
        $subscriptionOptions['iTunes'] = get_terms_meta($catID, 'itunes', true);
    }
    if (get_terms_meta($catID, 'goodreads', true)) {
        $subscriptionOptions['Goodreads'] = get_terms_meta($catID, 'goodreads', true);
    }
    if (get_terms_meta($catID, 'facebookurl', true)) {
        $subscriptionOptions['Facebook'] = get_terms_meta($catID, 'facebookurl', true);
    }
    if (get_terms_meta($catID, 'twitterid', true)) {
        $subscriptionOptions['Twitter'] = "https://twitter.com/" . get_terms_meta($catID, 'twitterid', true);
    }
    echo 'Subscribe: ' . andListKeyed($subscriptionOptions) . '.';
}
?>
                </tr></td></table>
                </div>
            </div>
            <?php 
/* End the Podcast Info Block! */
?>

            <div class="post-edit"><?php 
edit_post_link('Edit');
?>
</div>
示例#8
0
function category_thumb_src($category)
{
    if (function_exists('get_terms_meta')) {
        $val = get_terms_meta($category->cat_ID, 'thumbnail');
        $val = gettype($val) === 'array' ? array_shift($val) : $val;
        //Separar en nom + extensio
        $dot_pos = strrpos($val, ".");
        $ext = substr($val, $dot_pos);
        $name = substr($val, 0, $dot_pos);
        //Afegir wxh a continuacio nom i concatenar extensio
        return $name . '-' . width_x_height('category_thumb') . $ext;
    }
    return false;
}