質問

I am a new user of "Organize Series" WordPress plugin. Recently, I have made a Series TOC page for my site using the plugin.

Now, I want to add Meta Description for Series TOC page. For the archive page we can write is_archive(). Is there any way to trace the Series TOC page so that I can add meta description of my own for that particular page? Thanks in advance.

役に立ちましたか?

解決

The plugin code to show the TOC page is:

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;
    }
}

As the file seriestoc.php is not a regular page template, we cannot use is_page_template(). But we can use the same technique as the plugin:

global $wp_query;
if ( isset($wp_query->is_seriestoc) && $wp_query->is_seriestoc ) {
    // do_something();
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top