【问题标题】:Wordpress > Organize Series Plugin : Meta DescriptionWordpress > 组织系列插件:元描述
【发布时间】:2014-05-15 11:17:21
【问题描述】:

我是“组织系列”WordPress 插件的新用户。最近,我使用该插件为我的网站制作了一个系列目录页面。

现在,我想为系列目录页面添加元描述。对于归档页面,我们可以编写 is_archive()。有什么方法可以跟踪系列目录页面,以便我可以为该特定页面添加我自己的元描述?提前致谢。

【问题讨论】:

    标签: wordpress plugins


    【解决方案1】:

    显示目录页面的插件代码是:

    function orgSeries_toc_template() {
        global $wp_query;
        $settings = $this->settings;
        if ( isset($wp_query->is_seriestoc) && $wp_query->is_seriestoc ) {
            $template = locate_template(array('seriestoc.php')); // Search custom file in theme directory
            if (!$template)
                $template = WP_CONTENT_DIR . '/plugins/' . SERIES_DIR .'/seriestoc.php';
    
            include($template);
            exit;
        }
    }
    

    由于文件seriestoc.php不是常规的页面模板,我们不能使用is_page_template()。但我们可以使用与插件相同的技术:

    global $wp_query;
    if ( isset($wp_query->is_seriestoc) && $wp_query->is_seriestoc ) {
        // do_something();
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-11
      • 1970-01-01
      • 2018-12-17
      • 2017-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-09
      相关资源
      最近更新 更多