WordPress.org

Ready to get started?Download WordPress

Forums

WP Favorite Posts
code conflicts (1 post)

  1. macfee
    Member
    Posted 2 years ago #

    I add the following code to header.php

    ?>
    <?php
    if (is_home()) {
        //将以下引号中的内容改成你的首页description
        $description = "LanFM Radio免费提供国内外广播电台在线收听服务";
        // 将以下引号中的内容改成你的首页keywords
        $keywords = "LanFM Radio,电台,广播,网络电台,在线电台,音乐在线,广播电台,谈话节目,音乐电台,新闻电台,实时广播,体育广播,经济广播";
    }
    elseif (is_single() || is_page()) {
         $description1 = get_post_meta($post->ID, "description", true);
         $description2 = mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 200, "…");
    
         // 填写自定义字段description时显示自定义字段的内容,否则使用文章内容前100字作为描述
         $description = $description1 ? $description1 : $description2;
    
        // 填写自定义字段keywords时显示自定义字段的内容,否则使用文章tags作为关键词
        $keywords = get_post_meta($post->ID, "keywords", true);
        if($keywords == '') {
            $tags = wp_get_post_tags($post->ID);
            foreach ($tags as $tag ) {
                $keywords = $keywords . $tag->name . ", ";
            }
            $keywords = rtrim($keywords, ', ');
        }
    }
    elseif (is_category()) {
        $description = category_description();
        $keywords = single_cat_title('', false);
    }
    elseif (is_tag()){
        $description = tag_description();
        $keywords = single_tag_title('', false);
    }
    $description = trim(strip_tags($description));
    $keywords = trim(strip_tags($keywords));
    ?>

    In favourite page,the page header will occur such code where i add above codes;;

    <div class='wpfp-span'>

    • 收藏夹为空
    <img src='http://www.lanfm.com/wp-content/plugins/wp-favorite-posts/img/loading.gif' alt='Loading' title='Loading' class='wpfp-hide wpfp-img' />清空收藏夹</div>

    what happend? is it conflicted?

    http://wordpress.org/extend/plugins/wp-favorite-posts/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic