예제 #1
0
function generate_rand_tags_ajax()
{
    $tag_num = $_POST['tag_num'] ? $_POST['tag_num'] : 2;
    $max_len = $_POST['max_len'] ? $_POST['max_len'] : 13;
    global $wpdb;
    $terms = $wpdb->terms;
    $term_tax = $wpdb->term_taxonomy;
    $sql = "SELECT name,slug FROM {$terms} as t\n            JOIN {$term_tax} as tt\n            ON t.term_id = tt.term_id\n            WHERE tt.taxonomy = 'post_tag'\n            AND tt.count > 0\n            AND length(t.name) <= {$max_len}";
    $query = $wpdb->get_results($sql);
    $tags = array();
    while (count($tags) <= $tag_num - 1) {
        $key = array_rand($query, 1);
        if ($max_len && !in_array($query[$key], $tags)) {
            $tags[] = $query[$key];
        }
    }
    ?>
    <ul class="wp-tag-cloud">
        <li><a id="tag-generate" href="#"><span class="reloadtags glyphicon glyphicon-refresh" aria-hidden="true"></span></a></li>
        <?php 
    foreach ($tags as $tag) {
        echo "<li class='tag'><a href='" . get_site_url() . "/tag/" . $tag->slug . "'>" . $tag->name . "</a></li>";
    }
    ?>
        <li class="page_item"><a href="<?php 
    echo esc_url(get_permalink(get_ID_by_page_name('TV')));
    ?>
">WhoHaha TV</a></li>
        <li class="page_item shop"><a target="_blank" href="https://cznd.co/collections/whohaha">Shop</a></li>
    </ul>
    <?php 
    wp_die();
}
예제 #2
0
?>
">Contact</a></li>
							<li class="page_item"><a href="<?php 
echo esc_url(get_permalink(get_ID_by_page_name('Recommend')));
?>
">Recommend</a></li>
							<li class="page_item"><a href="<?php 
echo esc_url(get_permalink(get_ID_by_page_name('Terms Of Use')));
?>
">Terms Of Use</a></li>
							<li class="page_item"><a href="<?php 
echo esc_url(get_permalink(get_ID_by_page_name('Privacy Policy')));
?>
">Privacy Policy</a></li>
							<li class="page_item"><a href="<?php 
echo esc_url(get_permalink(get_ID_by_page_name('Subscribe')));
?>
">Subscribe</a></li>
						</ul>
					</nav>
					<div class="copyright">
						<div class="row">
							<div class="col-md-9">
								All rights reserved - <?php 
echo date("Y");
?>
. WhoHaha
							</div>
							<div class="col-md-3 text-right logos">
								<a class="dm2-logo" href="http://digitalmediamanagement.com/"></a>
								<!-- <a class="win-logo" href="http://womensinfluencernetwork.com/"></a> -->