当前位置: 首页>>代码示例>>PHP>>正文


PHP get_the_author_login函数代码示例

本文整理汇总了PHP中get_the_author_login函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_author_login函数的具体用法?PHP get_the_author_login怎么用?PHP get_the_author_login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_the_author_login函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: simplr_post_class

function simplr_post_class($print = true)
{
    global $post, $simplr_post_alt;
    $c = array('hentry', "p{$simplr_post_alt}", $post->post_type, $post->post_status);
    $c[] = 'author-' . get_the_author_login();
    if (is_attachment()) {
        $c[] = 'attachment';
    }
    foreach ((array) get_the_category() as $cat) {
        $c[] = 'category-' . $cat->category_nicename;
    }
    simplr_date_classes(mysql2date('U', $post->post_date), $c);
    if (++$simplr_post_alt % 2) {
        $c[] = 'alt';
    }
    $c = join(' ', apply_filters('post_class', $c));
    return $print ? print $c : $c;
}
开发者ID:josephholsten,项目名称:libera-ideoj-theme,代码行数:18,代码来源:functions.php

示例2: DisplayVotes

function DisplayVotes($postID, $type = '')
{
    global $user_ID, $guest_votes, $vote_text, $use_votetext, $allow_sinks, $voteiu_skin;
    $postID = wp_kses($postID, array());
    // Sanitize, just in case
    $voteiu_skin = get_option('voteiu_skin');
    $votes = GetVotes($postID);
    $barvotes = GetBarVotes($postID);
    switch ($type) {
        case '':
            // In the event no theme selected, use the current theme
            if ($voteiu_skin == '') {
                return DisplayVotes($postID, 'bar');
            } else {
                if (!LoadSkin($voteiu_skin)) {
                    return DisplayVotes($postID, 'bar');
                }
            }
            break;
            // The following themes below are pre-defined themes in the event there are no other themes found
        // The following themes below are pre-defined themes in the event there are no other themes found
        case 'bar':
            ?>
<span class="barcontainer"><span class="barfill" id="votecount<?php 
            echo $postID;
            ?>
" style="width:<?php 
            echo round($barvotes[0] * 2.5);
            ?>
%;">&nbsp;</span></span><?php 
            if ($user_ID != '') {
                if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                    ?>
<span><?php 
                    if (!UserVoted($postID, $user_ID)) {
                        ?>
<span class="bartext" id="voteid<?php 
                        the_ID();
                        ?>
">
						<a href="javascript:vote('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');"><?php 
                        echo get_option('voteiu_votetext');
                        ?>
</a><?php 
                        if (get_option('voteiu_sinktext') != '') {
                            ?>
<a href="javascript:sink('votecount<?php 
                            the_ID();
                            ?>
','voteid<?php 
                            the_ID();
                            ?>
','<?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
',<?php 
                            the_ID();
                            ?>
,<?php 
                            echo $user_ID;
                            ?>
,'<?php 
                            echo VoteItUp_ExtPath();
                            ?>
');"><?php 
                            echo get_option('voteiu_sinktext');
                            ?>
</a><?php 
                        }
                        ?>
</span><?php 
                    } else {
                        if (get_option('voteiu_aftervotetext') != '') {
                            ?>
<span class="bartext" id="voteid<?php 
                            the_ID();
                            ?>
"><?php 
                            echo get_option('voteiu_aftervotetext');
                            ?>
</span><?php 
                        }
//.........这里部分代码省略.........
开发者ID:eq0rip,项目名称:Hamroreview.com,代码行数:101,代码来源:voteitup.php

示例3: sandbox_post_class

function sandbox_post_class($print = true)
{
    global $post, $sandbox_post_alt;
    $c = array("p{$sandbox_post_alt}", $post->post_status);
    $c[] = 'author-' . get_the_author_login();
    sandbox_date_classes(mysql2date('U', $post->post_date), $c);
    if (++$sandbox_post_alt % 2) {
        $c[] = 'alt';
    }
    $c = join(' ', get_post_class($c, $post->ID));
    return $print ? print $c : $c;
}
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:12,代码来源:functions.php

示例4: LoadVote

function LoadVote()
{
    global $user_ID, $user_login;
    $postID = get_the_ID();
    $votes = GetVotes($postID, true);
    if (function_exists('VoteItUp_options')) {
        ?>
<span class="vote-it-up">
<span class="tickercontainer" id="votecount<?php 
        the_ID();
        ?>
"><?php 
        echo $votes == false ? "Vote" : $votes;
        ?>
</span>
<?php 
        if ($user_ID != '') {
            if (!($user_login == get_the_author_login() && !get_option('voteiu_allowownvote'))) {
                ?>
	<span>
	<?php 
                if (!UserVoted($postID, $user_ID)) {
                    ?>
<span class="tickertext">
			<span class="votelink" id="voteid<?php 
                    the_ID();
                    ?>
"><a href="javascript:vote('votecount<?php 
                    the_ID();
                    ?>
','voteid<?php 
                    the_ID();
                    ?>
','<?php 
                    echo get_option('voteiu_aftervotetext');
                    ?>
',<?php 
                    the_ID();
                    ?>
,<?php 
                    echo $user_ID;
                    ?>
,'<?php 
                    echo VoteItUp_ExtPath();
                    ?>
');" class="voteuplink"><?php 
                    echo get_option('voteiu_votetext');
                    ?>
</a><?php 
                    if (get_option('voteiu_sinktext') != '') {
                        ?>
<a href="javascript:sink('votecount<?php 
                        the_ID();
                        ?>
','voteid<?php 
                        the_ID();
                        ?>
','<?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
',<?php 
                        the_ID();
                        ?>
,<?php 
                        echo $user_ID;
                        ?>
,'<?php 
                        echo VoteItUp_ExtPath();
                        ?>
');" class="votedownlink"><?php 
                        echo get_option('voteiu_sinktext');
                        ?>
</a></span>
			<?php 
                    }
                    ?>

		</span>
	<?php 
                } else {
                    ?>
	<?php 
                    if (get_option('voteiu_aftervotetext') != '') {
                        ?>
<span class="tickertext" id="voteid<?php 
                        the_ID();
                        ?>
"><span class="votelink"><?php 
                        echo get_option('voteiu_aftervotetext');
                        ?>
</span></span><?php 
                    }
                    ?>
	<?php 
                }
                ?>
	</span>
<?php 
            } else {
                ?>
//.........这里部分代码省略.........
开发者ID:hameedullah,项目名称:Vote-It-Up,代码行数:101,代码来源:skin.php

示例5: comments_number

        comments_number(__('Leave a Response', 'gluedideas_subtle'), __('One Response', 'gluedideas_subtle'), '% ' . __('Responses', 'gluedideas_subtle'));
        ?>
</a></dd>
				</dl>
	
				<dl class="metadata even">
					<dt><?php 
        _e("Feeds and Links", 'gluedideas_subtle');
        ?>
</dt>
					<dd class="icon feed"><?php 
        comments_rss_link(__('Comment Feed', 'gluedideas_subtle'));
        ?>
</dd>
					<dd class="icon entry"><a href="<?php 
        get_author_link(true, get_the_author_ID(), get_the_author_login());
        ?>
"><?php 
        _e("From This Author", 'gluedideas_subtle');
        ?>
</a></dd>
					<dd class="icon delicious"><a href="http://del.icio.us/post?url=<?php 
        the_permalink();
        ?>
&amp;title=<?php 
        echo urlencode(get_the_title());
        ?>
">Del.icio.us</a></dd>
					<dd class="icon digg"><a href="http://www.digg.com/submit" target="_new">Digg</a></dd>
					<dd class="icon technorati"><a href="http://technorati.com/cosmos/search.html?url=<?php 
        urlencode(the_permalink());
开发者ID:rmccue,项目名称:wordpress-unit-tests,代码行数:31,代码来源:single.php

示例6: sandbox_body_class

function sandbox_body_class($print = true)
{
    global $wp_query, $current_user;
    // It's surely a WordPress blog, right?
    $c = array('wordpress');
    // Applies the time- and date-based classes (below) to BODY element
    sandbox_date_classes(time(), $c);
    // Generic semantic classes for what type of content is displayed
    is_home() ? $c[] = 'home' : null;
    is_archive() ? $c[] = 'archive' : null;
    is_date() ? $c[] = 'date' : null;
    is_search() ? $c[] = 'search' : null;
    is_paged() ? $c[] = 'paged' : null;
    is_attachment() ? $c[] = 'attachment' : null;
    is_404() ? $c[] = 'four04' : null;
    // CSS does not allow a digit as first character
    // Special classes for BODY element when a single post
    if (is_single()) {
        $postID = $wp_query->post->ID;
        the_post();
        // Adds 'single' class and class with the post ID
        $c[] = 'single postid-' . $postID;
        // Adds classes for the month, day, and hour when the post was published
        if (isset($wp_query->post->post_date)) {
            sandbox_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-');
        }
        // Adds category classes for each category on single posts
        if ($cats = get_the_category()) {
            foreach ($cats as $cat) {
                $c[] = 's-category-' . $cat->slug;
            }
        }
        // Adds tag classes for each tags on single posts
        if ($tags = get_the_tags()) {
            foreach ($tags as $tag) {
                $c[] = 's-tag-' . $tag->slug;
            }
        }
        // Adds MIME-specific classes for attachments
        if (is_attachment()) {
            $the_mime = get_post_mime_type();
            $boring_stuff = array("application/", "image/", "text/", "audio/", "video/", "music/");
            $c[] = 'attachment-' . str_replace($boring_stuff, "", "{$the_mime}");
        }
        // Adds author class for the post author
        $c[] = 's-author-' . sanitize_title_with_dashes(strtolower(get_the_author_login()));
        rewind_posts();
    } else {
        if (is_author()) {
            $author = $wp_query->get_queried_object();
            $c[] = 'author';
            $c[] = 'author-' . $author->user_nicename;
        } else {
            if (is_category()) {
                $cat = $wp_query->get_queried_object();
                $c[] = 'category';
                $c[] = 'category-' . $cat->slug;
            } else {
                if (is_tag()) {
                    $tags = $wp_query->get_queried_object();
                    $c[] = 'tag';
                    $c[] = 'tag-' . $tags->slug;
                    // Does not work; however I try to return the tag I get a false. Grrr.
                } else {
                    if (is_page()) {
                        $pageID = $wp_query->post->ID;
                        the_post();
                        $c[] = 'page pageid-' . $pageID;
                        $c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));
                        rewind_posts();
                    }
                }
            }
        }
    }
    // For when a visitor is logged in while browsing
    if ($current_user->ID) {
        $c[] = 'loggedin';
    }
    // Paged classes; for 'page X' classes of index, single, etc.
    if ((($page = $wp_query->get("paged")) || ($page = $wp_query->get("page"))) && $page > 1) {
        $c[] = 'paged-' . $page . '';
        if (is_single()) {
            $c[] = 'single-paged-' . $page . '';
        } else {
            if (is_page()) {
                $c[] = 'page-paged-' . $page . '';
            } else {
                if (is_category()) {
                    $c[] = 'category-paged-' . $page . '';
                } else {
                    if (is_tag()) {
                        $c[] = 'tag-paged-' . $page . '';
                    } else {
                        if (is_date()) {
                            $c[] = 'date-paged-' . $page . '';
                        } else {
                            if (is_author()) {
                                $c[] = 'author-paged-' . $page . '';
                            } else {
//.........这里部分代码省略.........
开发者ID:recordsonribs,项目名称:ror,代码行数:101,代码来源:functions.php

示例7: cfct_choose_content_template_author

function cfct_choose_content_template_author($type = 'content', $files = null)
{
    $files = cfct_author_templates($type, $files);
    if (count($files)) {
        $author = get_the_author_login();
        $file = 'author-' . $author . '.php';
        if (in_array($file, $files)) {
            $keys = array($author);
            return cfct_filename($type, 'author', $keys);
        }
    }
    return false;
}
开发者ID:alicam,项目名称:vanilla-theme,代码行数:13,代码来源:utility.php

示例8: thematic_body_class

function thematic_body_class($print = true)
{
    global $wp_query, $current_user;
    // It's surely a WordPress blog, right?
    $c = array('wordpress');
    // Applies the time- and date-based classes (below) to BODY element
    thematic_date_classes(time(), $c);
    // Generic semantic classes for what type of content is displayed
    is_front_page() ? $c[] = 'home' : null;
    // For the front page, if set
    is_home() ? $c[] = 'blog' : null;
    // For the blog posts page, if set
    is_archive() ? $c[] = 'archive' : null;
    is_date() ? $c[] = 'date' : null;
    is_search() ? $c[] = 'search' : null;
    is_paged() ? $c[] = 'paged' : null;
    is_attachment() ? $c[] = 'attachment' : null;
    is_404() ? $c[] = 'four04' : null;
    // CSS does not allow a digit as first character
    // Special classes for BODY element when a singular post
    if (is_singular()) {
        $c[] = 'singular';
    } else {
        $c[] = 'not-singular';
    }
    // Special classes for BODY element when a single post
    if (is_single()) {
        $postID = $wp_query->post->ID;
        the_post();
        // Adds post slug class, prefixed by 'slug-'
        $c[] = 'slug-' . $wp_query->post->post_name;
        // Adds 'single' class and class with the post ID
        $c[] = 'single postid-' . $postID;
        // Adds classes for the month, day, and hour when the post was published
        if (isset($wp_query->post->post_date)) {
            thematic_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-');
        }
        // Adds category classes for each category on single posts
        if ($cats = get_the_category()) {
            foreach ($cats as $cat) {
                $c[] = 's-category-' . $cat->slug;
            }
        }
        // Adds tag classes for each tags on single posts
        if ($tags = get_the_tags()) {
            foreach ($tags as $tag) {
                $c[] = 's-tag-' . $tag->slug;
            }
        }
        // Adds MIME-specific classes for attachments
        if (is_attachment()) {
            $mime_type = get_post_mime_type();
            $mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
            $c[] = 'attachmentid-' . $postID . ' attachment-' . str_replace($mime_prefix, "", "{$mime_type}");
        }
        // Adds author class for the post author
        $c[] = 's-author-' . sanitize_title_with_dashes(strtolower(get_the_author_login()));
        rewind_posts();
        // For posts with excerpts
        if (has_excerpt()) {
            $c[] = 's-has-excerpt';
        }
        // For posts with comments open or closed
        if (comments_open()) {
            $c[] = 's-comments-open';
        } else {
            $c[] = 's-comments-closed';
        }
        // For posts with pings open or closed
        if (pings_open()) {
            $c[] = 's-pings-open';
        } else {
            $c[] = 's-pings-closed';
        }
        // For password-protected posts
        if ($post->post_password) {
            $c[] = 's-protected';
        }
        // For sticky posts
        if (is_sticky()) {
            $c[] = 's-sticky';
        }
    } elseif (is_author()) {
        $author = $wp_query->get_queried_object();
        $c[] = 'author';
        $c[] = 'author-' . $author->user_nicename;
    } elseif (is_category()) {
        $cat = $wp_query->get_queried_object();
        $c[] = 'category';
        $c[] = 'category-' . $cat->slug;
    } elseif (is_tag()) {
        $tags = $wp_query->get_queried_object();
        $c[] = 'tag';
        $c[] = 'tag-' . $tags->slug;
    } elseif (is_page()) {
        $pageID = $wp_query->post->ID;
        $page_children = wp_list_pages("child_of={$pageID}&echo=0");
        the_post();
        // Adds post slug class, prefixed by 'slug-'
        $c[] = 'slug-' . $wp_query->post->post_name;
//.........这里部分代码省略.........
开发者ID:blazingcloud,项目名称:blog.blazingcloud.net,代码行数:101,代码来源:dynamic-classes.php

示例9: cfct_choose_single_template_author

function cfct_choose_single_template_author($dir, $files, $filter)
{
    $author_files = cfct_author_templates('', $files);
    if (count($author_files)) {
        $author = get_the_author_login();
        $file = cfct_filename_filter('author-' . $author . '.php', $filter);
        if (in_array($file, $author_files)) {
            return $file;
        }
    }
    return false;
}
开发者ID:Linuxwang,项目名称:PIE,代码行数:12,代码来源:utility.php

示例10: plaintxtblog_post_class

function plaintxtblog_post_class($print = true)
{
    global $post, $plaintxtblog_post_alt;
    $c = array('hentry', "p{$plaintxtblog_post_alt}", $post->post_type, $post->post_status);
    $c[] = 'author-' . get_the_author_login();
    foreach ((array) get_the_category() as $cat) {
        $c[] = 'category-' . $cat->category_nicename;
    }
    plaintxtblog_date_classes(mysql2date('U', $post->post_date), $c);
    if (++$plaintxtblog_post_alt % 2) {
        $c[] = 'alt';
    } elseif ($post->post_password) {
        $c[] = 'protected';
    }
    $c = join(' ', apply_filters('post_class', $c));
    return $print ? print $c : $c;
}
开发者ID:slaFFik,项目名称:l10n-ru,代码行数:17,代码来源:functions.php

示例11: semantic_body

/**
 * semantic_body() - Generates semantic classes for <body> element
 *
 * @since - 0.2
 * @filter semantic_body
 * @uses semantic_time()
 */
function semantic_body($classes = array())
{
    global $wp_query, $current_user;
    //$classes = get_body_class();
    // Starts the semantic markup array
    $sc = array('wpframework');
    // Generic semantic classes for what type of content is displayed
    is_front_page() ? $classes[] = 'home' : null;
    // For the front page, if set
    is_home() ? $classes[] = 'blog' : null;
    // For the blog posts page, if set
    is_singular() ? $classes[] = 'singular' : null;
    is_single() ? $classes[] = 'single' : null;
    is_archive() ? $classes[] = 'archive' : null;
    // For archive based templates: archive.php, author.php, category.php, tag.php
    is_date() ? $classes[] = 'date' : null;
    is_search() ? $classes[] = 'search' : null;
    is_paged() ? $classes[] = 'paged' : null;
    is_attachment() ? $classes[] = 'attachment' : null;
    is_404() ? $classes[] = 'error404' : null;
    // Applies the time- and date-based classes (below) to BODY element
    semantic_date_classes(time(), $classes);
    // Special classes for BODY element when a single post
    if (is_single()) {
        $postID = $wp_query->post->ID;
        the_post();
        // Adds 'single' class and class with the post ID
        $sc[] = 'single postid-' . $postID;
        // Adds classes for the month, day, and hour when the post was published
        if (isset($wp_query->post->post_date)) {
            semantic_date_classes(mysql2date('U', $wp_query->post->post_date), $classes, 's-');
        }
        // Adds MIME-specific classes for attachments
        if (is_attachment()) {
            $mime_type = get_post_mime_type();
            $mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
            $sc[] = 'attachmentid-' . $postID . ' attachment-' . str_replace($mime_prefix, "", "{$mime_type}");
        }
        // Adds category classes for each category on single posts
        if ($cats = get_the_category()) {
            foreach ($cats as $cat) {
                if ($cat) {
                    $classes[] = 's-category-' . $cat->slug;
                } else {
                    $classes[] = 's-category-none';
                }
            }
        }
        // Adds tag classes for each tags on single posts
        if ($tags = get_the_tags()) {
            foreach ($tags as $tag) {
                if ($tag) {
                    $classes[] = 's-tag-' . $tag->slug;
                } else {
                    $classes[] = 's-tag-none';
                }
            }
        }
        // Adds author class for the post author
        if (get_the_author_login()) {
            $s_author = sanitize_title_with_dashes(strtolower(get_the_author_login()));
        } else {
            $s_author = 'none';
        }
        $classes[] = 's-author-' . $s_author;
        rewind_posts();
    } elseif (is_author()) {
        $author = $wp_query->get_queried_object();
        $classes[] = 'author';
        if ($author) {
            $classes[] = 'author-' . $author->user_nicename;
        } else {
            $classes[] = 'author-none';
        }
    } elseif (is_category()) {
        $cat = $wp_query->get_queried_object();
        $classes[] = 'category';
        if ($cat) {
            $classes[] = 'category-' . $cat->slug;
        } else {
            $classes[] = 'category-none';
        }
    } elseif (is_tag()) {
        $tags = $wp_query->get_queried_object();
        $classes[] = 'tag';
        if ($tags) {
            $classes[] = 'tag-' . $tags->slug;
        } else {
            $classes[] = 'tag-none';
        }
    } elseif (is_page()) {
        $pageID = $wp_query->post->ID;
        $page_children = wp_list_pages("child_of={$pageID}&echo=0");
//.........这里部分代码省略.........
开发者ID:sandesh247,项目名称:sandesh247.com,代码行数:101,代码来源:semantic-classes.php

示例12: sandbox_body_class

function sandbox_body_class($print = true)
{
    global $wp_query, $current_user;
    // It's surely a WordPress blog, right?
    $c = array('wordpress');
    // Applies the time- and date-based classes (below) to BODY element
    sandbox_date_classes(time(), $c);
    // Generic semantic classes for what type of content is displayed
    is_front_page() ? $c[] = 'home' : null;
    // For the front page, if set
    is_home() ? $c[] = 'blog' : null;
    // For the blog posts page, if set
    is_archive() ? $c[] = 'archive' : null;
    is_date() ? $c[] = 'date' : null;
    is_search() ? $c[] = 'search' : null;
    is_paged() ? $c[] = 'paged' : null;
    is_attachment() ? $c[] = 'attachment' : null;
    is_404() ? $c[] = 'four04' : null;
    // CSS does not allow a digit as first character
    // Special classes for BODY element when a single post
    if (is_single()) {
        $postID = $wp_query->post->ID;
        the_post();
        // Adds 'single' class and class with the post ID
        $c[] = 'single postid-' . $postID;
        // Adds classes for the month, day, and hour when the post was published
        if (isset($wp_query->post->post_date)) {
            sandbox_date_classes(mysql2date('U', $wp_query->post->post_date), $c, 's-');
        }
        // Adds category classes for each category on single posts
        if ($cats = get_the_category()) {
            foreach ($cats as $cat) {
                $c[] = 's-category-' . $cat->slug;
            }
        }
        // Adds tag classes for each tags on single posts
        if ($tags = get_the_tags()) {
            foreach ($tags as $tag) {
                $c[] = 's-tag-' . $tag->slug;
            }
        }
        // Adds MIME-specific classes for attachments
        if (is_attachment()) {
            $mime_type = get_post_mime_type();
            $mime_prefix = array('application/', 'image/', 'text/', 'audio/', 'video/', 'music/');
            $c[] = 'attachmentid-' . $postID . ' attachment-' . str_replace($mime_prefix, "", "{$mime_type}");
        }
        // Adds author class for the post author
        $c[] = 's-author-' . sanitize_title_with_dashes(strtolower(get_the_author_login()));
        rewind_posts();
    } elseif (is_author()) {
        $author = $wp_query->get_queried_object();
        $c[] = 'author';
        $c[] = 'author-' . $author->user_nicename;
    } elseif (is_category()) {
        $cat = $wp_query->get_queried_object();
        $c[] = 'category';
        $c[] = 'category-' . $cat->slug;
    } elseif (is_tag()) {
        $tags = $wp_query->get_queried_object();
        $c[] = 'tag';
        $c[] = 'tag-' . $tags->slug;
    } elseif (is_page()) {
        $pageID = $wp_query->post->ID;
        $page_children = wp_list_pages("child_of={$pageID}&echo=0");
        the_post();
        $c[] = 'page pageid-' . $pageID;
        $c[] = 'page-author-' . sanitize_title_with_dashes(strtolower(get_the_author('login')));
        // Checks to see if the page has children and/or is a child page; props to Adam
        if ($page_children) {
            $c[] = 'page-parent';
        }
        if ($wp_query->post->post_parent) {
            $c[] = 'page-child parent-pageid-' . $wp_query->post->post_parent;
        }
        if (is_page_template()) {
            // Hat tip to Ian, themeshaper.com
            $c[] = 'page-template page-template-' . str_replace('.php', '-php', get_post_meta($pageID, '_wp_page_template', true));
        }
        rewind_posts();
    } elseif (is_search()) {
        the_post();
        if (have_posts()) {
            $c[] = 'search-results';
        } else {
            $c[] = 'search-no-results';
        }
        rewind_posts();
    }
    // Paged classes; for 'page X' classes of index, single, etc.
    if ((($page = $wp_query->get('paged')) || ($page = $wp_query->get('page'))) && $page > 1) {
        $c[] = 'paged-' . $page;
        if (is_single()) {
            $c[] = 'single-paged-' . $page;
        } elseif (is_page()) {
            $c[] = 'page-paged-' . $page;
        } elseif (is_category()) {
            $c[] = 'category-paged-' . $page;
        } elseif (is_tag()) {
            $c[] = 'tag-paged-' . $page;
//.........这里部分代码省略.........
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:101,代码来源:ashford_sandbox.php

示例13: webjournal_post_class

function webjournal_post_class( $print = true ) {
	global $post, $webjournal_post_alt;

	$c = array('hentry', "p$webjournal_post_alt", $post->post_type, $post->post_status);

	$c[] = 'author-' . get_the_author_login();

	if ( is_attachment() )
		$c[] = 'attachment';

	foreach ( (array) get_the_category() as $cat )
		$c[] = 'category-' . $cat->category_nicename;

	webjournal_date_classes(mysql2date('U', $post->post_date), $c);

	if ( ++$webjournal_post_alt % 2 )
		$c[] = 'alt';
		
	$c = join(' ', apply_filters('post_class', $c));

	return $print ? print($c) : $c;
}
开发者ID:nerdfiles,项目名称:web-journal,代码行数:22,代码来源:functions.php

示例14: cfct_choose_single_template

function cfct_choose_single_template($files = array(), $filter = '*')
{
    // must be called within the_loop - cfct_choose_general_template_single() approximates a loop for this reason.
    $exec_order = array('author', 'meta', 'category', 'role', 'tag', 'parent', 'default');
    $exec_order = apply_filters('cfct_single_match_order', $exec_order);
    $filename = false;
    global $post;
    foreach ($exec_order as $type) {
        switch ($type) {
            case 'author':
                $author_files = cfct_author_templates('', $files);
                if (count($author_files)) {
                    $author = get_the_author_login();
                    $file = cfct_filename_filter('author-' . $author . '.php', $filter);
                    if (in_array($file, $author_files)) {
                        $filename = $file;
                    }
                }
                break;
            case 'meta':
                $meta_files = cfct_meta_templates('', $files);
                if (count($meta_files)) {
                    $meta = get_post_custom($post->ID);
                    if (count($meta)) {
                        // check key, value matches first
                        foreach ($meta as $k => $v) {
                            $val = $v[0];
                            $file = cfct_filename_filter('meta-' . $k . '-' . $val . '.php', $filter);
                            if (in_array($file, $meta_files)) {
                                $filename = $file;
                                break;
                            }
                        }
                        // check key matches only
                        if (!$filename) {
                            foreach ($meta as $k => $v) {
                                $file = cfct_filename_filter('meta-' . $k . '.php', $filter);
                                if (in_array($file, $meta_files)) {
                                    $filename = $file;
                                    break;
                                }
                            }
                        }
                    }
                }
                break;
            case 'category':
                $cat_files = cfct_cat_templates($type, $files);
                if (count($cat_files)) {
                    foreach ($cat_files as $file) {
                        $cat_id = cfct_cat_filename_to_id($file);
                        if (in_category($cat_id)) {
                            $filename = $file;
                            break;
                        }
                    }
                }
                break;
            case 'role':
                $role_files = cfct_role_templates($type, $files);
                if (count($role_files)) {
                    $user = new WP_User(get_the_author_ID());
                    if (count($user->roles)) {
                        foreach ($role_files as $file) {
                            foreach ($user->roles as $role) {
                                if (cfct_role_filename_to_name($file) == $role) {
                                    $filename = $file;
                                    break;
                                }
                            }
                        }
                    }
                }
                break;
            case 'tag':
                $tag_files = cfct_tag_templates($type, $files);
                if (count($tag_files)) {
                    $tags = get_the_tags($post->ID);
                    if (is_array($tags) && count($tags)) {
                        foreach ($tag_files as $file) {
                            foreach ($tags as $tag) {
                                if ($tag->slug == cfct_tag_filename_to_name($file)) {
                                    $filename = $file;
                                    break;
                                }
                            }
                        }
                    }
                }
                break;
            case 'parent':
                $parent_files = cfct_parent_templates($type, $files);
                if (count($parent_files) && $post->post_parent > 0) {
                    $parent = cfct_post_id_to_slug($post->post_parent);
                    $file = cfct_filename_filter('parent-' . $parent . '.php', $filter);
                    if (in_array($file, $parent_files)) {
                        $filename = $file;
                    }
                }
                break;
//.........这里部分代码省略.........
开发者ID:rascoop,项目名称:carrington,代码行数:101,代码来源:utility.php

示例15: the_author_login

/**
 * Display the login name of the author of the current post.
 *
 * @link http://codex.wordpress.org/Template_Tags/the_author_login
 * @since 0.71
 * @see get_the_author_login()
 */
function the_author_login()
{
    echo get_the_author_login();
}
开发者ID:schr,项目名称:wordpress,代码行数:11,代码来源:author-template.php


注:本文中的get_the_author_login函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。