function get_link_list($id, $catname)
{
    global $wpdb, $wp_affiliate_prefix;
    $table_name = $wpdb->prefix . $wp_affiliate_prefix . "_links";
    $results = $wpdb->get_results("SELECT * FROM " . $table_name . " WHERE category=" . $id);
    $link_list = "<ul>\n<li></li>\n";
    foreach ($results as $result) {
        $clean_cat = get_category_slug($result->category);
        $clean_link = get_bloginfo('wpurl') . "" . $clean_cat . "/" . $result->slug;
        $send_to_editor = "send_to_editor(\"<a href=" . $clean_link . " target=_blank>" . $result->anchor_text . "</a>\");return false;";
        $link_list .= "<li id=\"linkli" . $result->id . "\"><b>Real Link:</b> " . $result->link . " <br /><b>Link:</b> " . get_bloginfo('wpurl') . "" . $clean_cat . "/" . $result->slug . " <br /> <b>Anchor Text:</b> " . $result->anchor_text . " <br /> <a href=\"#\" onclick='" . $send_to_editor . "'>Send Link To Editor</a> <a href=\"#\" onclick='copyToClipboard\t(\"" . $clean_link . "\");return false;'>Copy Link To Clipboard</a> (<a href=\"#\" onclick=\"wp_affiliate_ajax_delete_link(" . $result->id . ");return false;\">Delete Link</a>) </li>\n";
    }
    $link_list .= "</ul>\n";
    return $link_list;
}
function wp_affiliate_rewrite_rules($rules)
{
    global $wp_rewrite, $wpdb, $wp_affiliate_prefix;
    $table_name = $wpdb->prefix . $wp_affiliate_prefix . "_links";
    $results = $wpdb->get_results("SELECT * FROM " . $table_name, OBJECT);
    $new_rules = array();
    if ($results) {
        foreach ($results as $result) {
            $the_slug = substr(get_category_slug($result->category) . "/" . $result->slug, 1);
            $new_rules[$the_slug . "\$"] = 'index.php?wpaaction=wp_affiliate_redirect&wpaslug=' . urlencode($result->slug);
        }
        $rules = $new_rules + $rules;
    }
    return $rules;
}
/**
 * 优雅文章slug URL生成
 *
 * @param string $slug 文章slug
 * @param int $id 文章id
 * @param string $cslug 分类slug
 * @param int $id 分类id
 * @return string 返回slug化的字符串
 */
function get_article_slug($slug, $id, $cslug, $cid)
{
    $slug = get_slug($slug, $id);
    $cslug = get_category_slug($cslug, $cid);
    return '/' . ltrim($cslug, '/') . '/' . $slug . '.html';
}
    $licount = 0;
    foreach ($categoriestop as $category) {
        echo '<li><a href="#filter" data-option-value=".category-' . get_category_slug($category->url) . '" title="' . $category->title . '" ' . ' class="post-category-item" >' . get_category_slug($category->url) . '</a></li>';
        //$licount++;
        if ($licount >= 6) {
            echo '<br>';
            $licount = 0;
        }
    }
} else {
    ?>
                                            <ul id="top" class=" post-category"  >
                                <?php 
    $licount = 0;
    foreach ($categoriestop as $category) {
        echo '<li ><a href="' . $category->url . '" title="' . $category->title . '" ' . ' class="post-category-item" >' . get_category_slug($category->url) . '</a></li>';
        //$licount++;
        if ($licount >= 6) {
            echo '<br>';
            $licount = 0;
        }
    }
}
?>
                                          </ul>
                            </div>

                          </nav>

                        <?php 
if ($data['full_width'] == 'fixed' || $data['full_width'] == 'only_grid') {