コード例 #1
0
ファイル: theme-widgets.php プロジェクト: juslee/e27
function authorWidget()
{
    $settings = get_option("widget_authorwidget");
    $title = $settings['title'];
    if ($title == "") {
        $title = __('Author Info', 'woothemes');
    }
    if (is_single()) {
        ?>

<div id="author" class="widget">
	<h3 class="widget_title"><img src="<?php 
        bloginfo('template_directory');
        ?>
/images/ico-author.png" alt="" /><?php 
        echo $title;
        ?>
</h3>
	<div class="wrap">
		<div class="fl"><?php 
        echo get_avatar(get_the_author_id(), '48');
        ?>
</div>
        <span class="author-info"><?php 
        _e('This post was written by', 'woothemes');
        ?>
 <?php 
        the_author_posts_link();
        ?>
 <?php 
        _e('who has written', 'woothemes');
        ?>
 <?php 
        the_author_posts();
        ?>
 <?php 
        _e('posts on', 'woothemes');
        ?>
 <a href="<?php 
        echo get_option('home');
        ?>
/"><?php 
        bloginfo('name');
        ?>
</a>.</span>
		<br class="fix"></br>
		<p class="author-desc"><?php 
        the_author_description();
        ?>
</p>
	</div>
</div>

<?php 
    }
}
コード例 #2
0
ファイル: template.php プロジェクト: jagtesh/op_theme
/**
 * {@internal Missing Short Description }}
 * 
 * {@internal Missing Long Description }}
 * 
 * @ignore
 * @since	0.5.2
 */
function bf_author_information()
{
    if (bf_get_option('display_author')) {
        echo '<div class="author-desc vcard">';
        echo '<h5>Author Information</h5>';
        echo '<div class="fn description">';
        the_author_description();
        echo '</div></div>';
    }
}
コード例 #3
0
    <!-- Go to www.addthis.com/dashboard to customize your tools -->
    <div class="addthis_sharing_toolbox"></div>

    <div class="row">

        <div class="col-sm-11">

            <div class="conteudo">
                <?php 
the_content();
?>
            </div>

            <div class="dados-autor">
                <div class="descricao-autor">
                    <?php 
the_author_description();
?>
 
                </div>

            </div>
        
        </div>

    </div>



</article><!-- #post-## -->
コード例 #4
0
    function blog_author_info()
    {
        ?>
<section id="about_the_author">
	<h3><?php 
        _e('About the author', 'striking_front');
        ?>
</h3>
	<div class="author_content">
		<div class="gravatar"><?php 
        echo get_avatar(get_the_author_meta('user_email'), '60');
        ?>
</div>
		<div class="author_info">
			<div class="author_name"><?php 
        the_author_posts_link();
        ?>
</div>
			<p class="author_desc"><?php 
        the_author_description();
        ?>
</p>
		</div>
		<div class="clearboth"></div>
	</div>
</section>
<?php 
    }
コード例 #5
0
ファイル: widgets.php プロジェクト: JeffLuckett/quickref
    function widget($args, $instance)
    {
        extract($args);
        $title = empty($instance['title']) ? __('About', 'k2_domain') : apply_filters('widget_title', $instance['title']);
        $message = stripslashes($instance['message']);
        if (is_home() or is_front_page() or is_page()) {
            if (!empty($message)) {
                echo $before_widget;
                if ($title != '<none>') {
                    echo $before_title . $title . $after_title;
                }
                echo '<div>' . $message . '</div>' . $after_widget;
            }
        } elseif (!is_singular()) {
            echo $before_widget;
            if ($title != '<none>') {
                echo $before_title . $title . $after_title;
            }
            ?>

		<?php 
            if (is_category()) {
                // Category Archive
                ?>
			<p><?php 
                printf(__('The %1$s archives for the %2$s category.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>', single_cat_title('', false));
                ?>
</p>

		<?php 
            } elseif (is_day()) {
                // Day Archive
                ?>
			<p><?php 
                printf(__('The %1$s archives for %2$s.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>', get_the_time(__('l, F jS, Y', 'k2_domain')));
                ?>
</p>

		<?php 
            } elseif (is_month()) {
                // Monthly Archive
                ?>
			<p><?php 
                printf(__('The %1$s archives for %2$s.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>', get_the_time(__('F, Y', 'k2_domain')));
                ?>
</p>

		<?php 
            } elseif (is_year()) {
                // Yearly Archive
                ?>
			<p><?php 
                printf(__('The %1$s archives for %2$s.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>', get_the_time('Y'));
                ?>
</p>

		<?php 
            } elseif (is_search()) {
                // Search
                ?>
			<p><?php 
                printf(__('You searched the %1$s archives for <strong>%2$s</strong>.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>', esc_attr(get_search_query()));
                ?>
</p>

		<?php 
            } elseif (is_author()) {
                // Author Archive
                ?>
			<p><?php 
                printf(__('Archive for <strong>%s</strong>.', 'k2_domain'), get_the_author());
                ?>
</p>
			<p><?php 
                the_author_description();
                ?>
</p>

		<?php 
            } elseif (is_tag()) {
                // Tag Archive
                ?>
			<p><?php 
                printf(__('The %1$s archives for the <strong>%2$s</strong> tag.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>', get_query_var('tag'));
                ?>
</p>

		<?php 
            } elseif (is_paged()) {
                // Paged Archive
                ?>
			<p><?php 
                printf(__('The %s weblog archives.', 'k2_domain'), '<a href="' . get_option('siteurl') . '">' . get_bloginfo('name') . '</a>');
                ?>
</p>

		<?php 
            }
            ?>
	<?php 
            echo $after_widget;
        }
    }
コード例 #6
0
ファイル: page_info.php プロジェクト: billerby/Surdeg
    function author_info()
    {
        ?>
		<div class="info">
			<a title="<?php 
        _e('Subscribe to this!', 'guangzhou');
        ?>
" href="<?php 
        echo $this->archive_feed();
        ?>
"><img src="<?php 
        bloginfo('template_url');
        ?>
/image/feed.png" width="16" height="16" alt="RSS"/></a>
		</div>
		
		<h2><?php 
        _e('Author Information', 'guangzhou');
        ?>
</h2>
		
		<?php 
        if ($this->archive_total() > 0) {
            ?>
			<p><?php 
            printf(__('The author has written <strong>%s entries</strong>.', 'guangzhou'), $this->archive_total());
            ?>
</p>
		<?php 
        }
        ?>
		
		<dl>
			<dt><?php 
        _e('Name', 'guangzhou');
        ?>
</dt>
			<dd>
				<?php 
        the_author();
        ?>
				<?php 
        if (get_the_author_url()) {
            ?>
					<?php 
            printf(__('(visit <a href="%s">website</a>', 'guangzhou'), get_the_author_url());
            ?>
				<?php 
        }
        ?>
			</dd>
			
			
			<?php 
        if (get_the_author_description()) {
            ?>
			<dt><?php 
            _e('Description', 'guangzhou');
            ?>
</dt>
			<dd><?php 
            the_author_description();
            ?>
</dd>
			<?php 
        }
        ?>
			
			<?php 
        do_action('author_page_info');
        ?>
		</dl>
		
		<?php 
    }
コード例 #7
0
ファイル: template.php プロジェクト: Creativebq/wp-istalker
function wpi_template_attachment()
{
    global $post;
    $pby_class = wpi_get_theme_option('post_by_enable') ? 'pby' : 'pby dn';
    ?>
	<ul class="hfeed r cf">
	<?php 
    while (have_posts()) {
        the_post();
        ?>
	<li class="xfolkentry hentry hreview hlisting cf">		
		<dl class="r">
			<dd class="postmeta-date fl">
				<ul class="span-1 pdate r">
					<li class="pmonth"><span><?php 
        the_time('M');
        ?>
</span></li>
					<li class="pday"><span><?php 
        the_time('d');
        ?>
</span></li>
					<li class="pyear"><span><?php 
        the_time('Y');
        ?>
</span></li>
				</ul>
			</dd>
			<dd class="postmeta-head span-13 start fl">
				<?php 
        wpi_hatom_title();
        ?>
				<div class="postmeta-info">				
				<span class="<?php 
        echo $pby_class;
        ?>
">Posted by <cite class="vcard reviewer author"><?php 
        wpi_post_author();
        ?>
</cite>.</span> <p class="di"><?php 
        _e('Filed under', WPI_META);
        wpi_cat_links(1);
        ?>
.</p>
					<p><span class="ptime r"><?php 
        printf(__(' <cite>%s</cite>', WPI_META), wpi_get_postime());
        ?>
</span></p><?php 
        wpi_text_size();
        ?>
 
				</div>	
			</dd>
			<dd class="entry-content description entry cb ox">
			<?php 
        do_action('wpi_before_content_attachment');
        ?>
<div class="entry-attachment pdt"><a href="<?php 
        echo wp_get_attachment_url($post->ID);
        ?>
" title="<?php 
        echo wp_specialchars(get_the_title($post->ID), 1);
        ?>
" class="thickbox thumb-" rel="attachment"><?php 
        echo wp_get_attachment_image($post->ID, 'large');
        ?>
</a></div>
					<div class="entry-caption mgt"><?php 
        if (!empty($post->post_excerpt)) {
            the_excerpt();
        }
        ?>
</div>			
					<?php 
        if (wpi_option('post_author_description')) {
            ?>
					<fieldset id="post-author" class="cb cf pdt mgt">
						<?php 
            $ll = __('About the Author', WPI_META);
            ?>
						<?php 
            t('legend', $ll, array('title' => $ll));
            ?>
						
					<address class="author-avatar <?php 
            wpiGravatar::authorGID();
            ?>
 rn fl">
					<span class="rtxt">&nbsp;</span>
					</address>	
					<p id="about-author" class="postmetadata fl">
						<small class="db rn"><?php 
            the_author_description();
            ?>
&nbsp;</small>
					</p>
					</fieldset>
				<?php 
        }
        ?>
			</dd>
			<?php 
        $rating_class = wpi_get_theme_option('post_hrating') ? 'rating-count' : 'rating-count dn';
        ?>
			<dd class="postmeta-comments cf">
			<ul class="xoxo cfl r cf">
			<li class="<?php 
        echo $rating_class;
        ?>
"><?php 
        wpi_hrating();
        ?>
&nbsp;</li>
			<?php 
        if (wpi_get_theme_option('post_bookmarks')) {
            ?>
			<li class="postmeta-response"><?php 
            wpi_bookmarks();
            ?>
			
			<?php 
        }
        ?>
			</li>
			
			</ul>
			<?php 
        edit_post_link(__('Edit this entry.', WPI_META), '<p class="cb edit-links">', '</p>');
        ?>
			</dd>
			<dd class="dn">
				<ul class="more">
					<li class="node-1">				
						<abbr class="dtstart published dtreviewed dc-date" title="<?php 
        the_time('Y-m-dTH:i:s:Z');
        ?>
"><?php 
        the_time('F j, Y');
        ?>
 at <?php 
        the_time('g:i a');
        ?>
</abbr>	
					</li>
					<li class="node-2">
						<abbr class="dtend updated dtexpired" title="<?php 
        the_modified_date('Y-m-dTH:i:s:Z');
        ?>
"><?php 
        the_modified_date('F j, Y');
        ?>
 at <?php 
        the_modified_date('g:i a');
        ?>
</abbr>
					</li>
					<li class="version">0.3</li>
					<li class="type">url</li>					
				</ul>
			</dd>			
		</dl>
<!--
<?php 
        trackback_rdf();
        ?>
-->			
	</li>
	<?php 
    }
    ?>
	</ul>
<?php 
}
コード例 #8
0
ファイル: aboutcurrent.php プロジェクト: 64kbytes/stayinba
function about_sidebar_module($args)
{
    global $s;
    extract($args);
    $k2about = sbm_get_option('aboutblurp');
    if (!(is_home() and !is_paged() and $k2about == '' or is_single() or is_page())) {
        echo $before_module . $before_title . $title . $after_title;
        ?>
		<?php 
        /* Frontpage */
        if (is_home() and !is_paged() and $k2about != '') {
            ?>
		<p><?php 
            echo stripslashes($k2about);
            ?>
</p>

		<?php 
            /* Category Archive */
        } elseif (is_category()) {
            ?>
		<p><?php 
            printf(__('The %1$s archives for the %2$s category.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>', single_cat_title('', false));
            ?>
</p>

		<?php 
            /* Day Archive */
        } elseif (is_day()) {
            ?>
		<p><?php 
            printf(__('The %1$s archives for %2$s.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>', get_the_time(__('l, F jS, Y', 'k2_domain')));
            ?>
</p>

		<?php 
            /* Monthly Archive */
        } elseif (is_month()) {
            ?>
		<p><?php 
            printf(__('The %1$s archives for %2$s.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>', get_the_time(__('F, Y', 'k2_domain')));
            ?>
</p>

		<?php 
            /* Yearly Archive */
        } elseif (is_year()) {
            ?>
		<p><?php 
            printf(__('The %1$s archives for %2$s.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>', get_the_time('Y'));
            ?>
</p>

		<?php 
            /* Search */
        } elseif (is_search()) {
            ?>
		<p><?php 
            printf(__('You searched the %1$s archives for \'<strong>%2$s</strong>\'.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>', wp_specialchars(stripslashes($s), true));
            ?>
</p>

		<?php 
            /* Author Archive */
        } elseif (is_author()) {
            ?>
		<p><?php 
            printf(__('Archive for <strong>%s</strong>.', 'k2_domain'), get_the_author());
            ?>
</p>
		<p><?php 
            the_author_description();
            ?>
</p>

		<?php 
            /* Tag Archive */
        } elseif (function_exists('is_tag') and is_tag()) {
            ?>
		<p><?php 
            printf(__('The %1$s archives for the \'%2$s\' tag.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>', get_query_var('tag'));
            ?>
</p>

		<?php 
            /* Paged Archive */
        } elseif (is_paged()) {
            ?>
		<p><?php 
            printf(__('The %s weblog archives.', 'k2_domain'), '<a href="' . get_settings('siteurl') . '">' . get_bloginfo('name') . '</a>');
            ?>
</p>

		<?php 
        }
        echo $after_module;
    }
}
コード例 #9
0
ファイル: bfa_postinfo.php プロジェクト: billerby/Surdeg
function postinfo($postinfo_string)
{
    // one theme option needed below for nofollow trackback / RSS links yes/no
    global $bfa_ata, $post;
    /* replace date format escape placeholders(#) with the actual escpae
    	character (=backslashes). This function removes all backslashes from
    	post info strings to avoid issues with hosts that have magic_quotes_gpc ON.
    	But we want to keep the backslashes inside date items, because they are
    	needed to escape literal strings inside dates */
    $postinfo_string = str_replace("#", "\\", $postinfo_string);
    $postinfo = $postinfo_string;
    // Author public name
    if (strpos($postinfo_string, '%author%') !== FALSE) {
        ob_start();
        the_author();
        $author = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author%", $author, $postinfo);
    }
    // Public name of Author who last modified a post, since WordPress 2.8.
    // Check first if function is available (= if this is WP 2.8+)
    if (function_exists('the_modified_author')) {
        if (strpos($postinfo_string, '%modified-author%') !== FALSE) {
            ob_start();
            the_modified_author();
            $modified_author = ob_get_contents();
            ob_end_clean();
            $postinfo = str_replace("%modified-author%", $modified_author, $postinfo);
        }
    }
    // Author about yourself
    if (strpos($postinfo_string, '%author-description%') !== FALSE) {
        ob_start();
        the_author_description();
        $author_description = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-description%", $author_description, $postinfo);
    }
    // Author login name
    if (strpos($postinfo_string, '%author-login%') !== FALSE) {
        ob_start();
        the_author_login();
        $author_login = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-login%", $author_login, $postinfo);
    }
    // Author first name
    if (strpos($postinfo_string, '%author-firstname%') !== FALSE) {
        ob_start();
        the_author_firstname();
        $author_firstname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-firstname%", $author_firstname, $postinfo);
    }
    // Author last name
    if (strpos($postinfo_string, '%author-lastname%') !== FALSE) {
        ob_start();
        the_author_lastname();
        $author_lastname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-lastname%", $author_lastname, $postinfo);
    }
    // Author nickname
    if (strpos($postinfo_string, '%author-nickname%') !== FALSE) {
        ob_start();
        the_author_nickname();
        $author_nickname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-nickname%", $author_nickname, $postinfo);
    }
    // Author ID
    if (strpos($postinfo_string, '%author-id%') !== FALSE) {
        ob_start();
        the_author_ID();
        $author_ID = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-id%", $author_ID, $postinfo);
    }
    // Author email address, clear text in HTML source code
    if (strpos($postinfo_string, '%author-email-clear%') !== FALSE) {
        ob_start();
        the_author_email();
        $author_email_clear = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-email-clear%", $author_email_clear, $postinfo);
    }
    // Author email address obfuscated
    if (strpos($postinfo_string, '%author-email%') !== FALSE) {
        $postinfo = str_replace("%author-email%", antispambot(get_the_author_email()), $postinfo);
    }
    // Author website URL
    if (strpos($postinfo_string, '%author-url%') !== FALSE) {
        ob_start();
        the_author_url();
        $author_url = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-url%", $author_url, $postinfo);
    }
    // Author website link
    if (strpos($postinfo_string, '%author-link%') !== FALSE) {
        ob_start();
        the_author_link();
        $author_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-link%", $author_link, $postinfo);
    }
    // Author posts archive link
    if (strpos($postinfo_string, '%author-posts-link%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-posts-link%", $author_posts_link, $postinfo);
    }
    //  LEGACY: %author-linked% replaced by %author-posts-link% in 3.3.2, but displays the same: Author posts archive link
    if (strpos($postinfo_string, '%author-linked%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-linked%", $author_posts_link, $postinfo);
    }
    // Author post count
    if (strpos($postinfo_string, '%author-post-count%') !== FALSE) {
        ob_start();
        the_author_posts();
        $author_post_count = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-post-count%", $author_post_count, $postinfo);
    }
    // Author AOL Instant Messenger screenname
    if (strpos($postinfo_string, '%author-aim%') !== FALSE) {
        ob_start();
        the_author_aim();
        $author_aim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-aim%", $author_aim, $postinfo);
    }
    // Author Yahoo IM ID
    if (strpos($postinfo_string, '%author-yim%') !== FALSE) {
        ob_start();
        the_author_yim();
        $author_yim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-yim%", $author_yim, $postinfo);
    }
    // Date & Time
    if (strpos($postinfo_string, '%date(') !== FALSE) {
        $date_param = preg_match("/(.*)\\%date\\('(.*?)'\\)(.*)/i", $postinfo_string, $date_matches);
        ob_start();
        the_time($date_matches[2]);
        $date = ob_get_contents();
        ob_end_clean();
        $postinfo = preg_replace("/(.*)%date\\((.*?)\\)%(.*)/i", "\${1}" . $date . "\${3}", $postinfo);
    }
    // Date & Time, last modified
    if (strpos($postinfo_string, '%date-modified(') !== FALSE) {
        $date_param = preg_match("/(.*)\\%date-modified\\('(.*?)'\\)(.*)/i", $postinfo_string, $date_matches);
        ob_start();
        the_modified_time($date_matches[2]);
        $date_modified = ob_get_contents();
        ob_end_clean();
        $postinfo = preg_replace("/(.*)%date-modified\\((.*?)\\)%(.*)/i", "\${1}" . $date_modified . "\${3}", $postinfo);
    }
    // Tags, linked - since WP 2.3
    if (strpos($postinfo_string, '%tags-linked') !== FALSE) {
        $tag_link_options = preg_match("/(.*)%tags-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
        $tags_linked = get_the_tag_list($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
        $postinfo = preg_replace("/(.*)%tags-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_linked . "\${3}", $postinfo);
    }
    // Tags, linked. If post has no tags, categories are displayed instead -  since WP 2.3
    if (strpos($postinfo_string, '%tags-cats-linked') !== FALSE) {
        $tag_link_options = preg_match("/(.*)%tags-cats-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
        ob_start();
        the_tags($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
        $tags_cats_linked = ob_get_contents();
        ob_end_clean();
        $postinfo = preg_replace("/(.*)%tags-cats-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_cats_linked . "\${3}", $postinfo);
    }
    // Tags, not linked - since WP 2.3
    if (strpos($postinfo_string, '%tags(') !== FALSE) {
        $tag_options = preg_match("/(.*)%tags\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_matches);
        $posttags = get_the_tags();
        if ($posttags) {
            foreach ($posttags as $tag) {
                $tag_list .= $tag->name . $tag_matches[4];
            }
            // remove last separator
            $tag_list = preg_replace("/" . $tag_matches[4] . "\$/mi", "", $tag_list);
            $tags = $tag_matches[2] . $tag_list . $tag_matches[6];
        } else {
            $tags = "";
        }
        $postinfo = preg_replace("/(.*)%tags\\((.*?)\\)%(.*)/i", "\${1}" . $tags . "\${3}", $postinfo);
    }
    // 1st category
    if (strpos($postinfo_string, '%category%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_notlinked = $category;
        $postinfo = str_replace("%category%", $category_notlinked, $postinfo);
    }
    // 1st category, linked
    if (strpos($postinfo_string, '%category-linked%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_linked = '<a href="' . get_category_link($all_categories[0]->cat_ID) . '">' . $category . '</a>';
        $postinfo = str_replace("%category-linked%", $category_linked, $postinfo);
    }
    // Categories, linked
    if (strpos($postinfo_string, '%categories-linked') !== FALSE) {
        $category_linked_separator = preg_match("/(.*)%categories-linked\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_linked_matches);
        ob_start();
        the_category($category_linked_matches[2]);
        $categories_linked = ob_get_contents();
        ob_end_clean();
        $postinfo = preg_replace("/(.*)%categories-linked\\((.*?)\\)%(.*)/i", "\${1}" . $categories_linked . "\${3}", $postinfo);
    }
    // Categories, not linked
    if (strpos($postinfo_string, '%categories(') !== FALSE) {
        $category_separator = preg_match("/(.*)%categories\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_matches);
        $categories = "";
        foreach (get_the_category() as $category) {
            $categories .= $category->cat_name . $category_matches[2];
        }
        // remove last separator
        $categories = preg_replace("/" . $category_matches[2] . "\$/mi", "", $categories);
        $postinfo = preg_replace("/(.*)%categories\\((.*?)\\)%(.*)/i", "\${1}" . $categories . "\${3}", $postinfo);
    }
    // Comment link
    if (strpos($postinfo_string, '%comments(') !== FALSE) {
        $comment_options = preg_match("/(.*)%comments\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $comment_matches);
        if (!comments_open() and $comment_matches[8] == "dontshow") {
            $comment_link = '';
        } else {
            ob_start();
            comments_popup_link($comment_matches[2], $comment_matches[4], $comment_matches[6], 'comments-link', $comment_matches[8]);
            $comment_link = ob_get_contents();
            ob_end_clean();
        }
        if (!comments_open()) {
            if ($post->comment_count == 0) {
                $comment_link = '<strong>' . $comment_matches[8] . '</strong>';
            } else {
                $comment_link = $comment_link . ' - <strong>(' . $comment_matches[8] . ')</strong>';
            }
        }
        if (!comments_open() and $comment_matches[8] == "dontshow") {
            $comment_link = '';
        }
        $postinfo = preg_replace("/(.*)%comments\\((.*?)\\)%(.*)/i", "\${1}" . $comment_link . "\${3}", $postinfo);
    }
    // Comments Feed link
    if (strpos($postinfo_string, '%comments-rss') !== FALSE) {
        $comments_rss_link_text = preg_match("/(.*)%comments-rss\\('(.*?)'(.*)/i", $postinfo_string, $comments_rss_matches);
        ob_start();
        //  "post_comments_feed_link" since WP 2.5, else "comments_rss_link"
        if (function_exists('post_comments_feed_link')) {
            post_comments_feed_link($comments_rss_matches[2]);
        } else {
            comments_rss_link($comments_rss_matches[2]);
        }
        $comments_rss_link = ob_get_contents();
        ob_end_clean();
        // make link nofollow if set in theme options
        if ($bfa_ata['nofollow'] == "Yes") {
            $comments_rss_link = str_replace('href=', 'rel="nofollow" href=', $comments_rss_link);
        }
        $postinfo = preg_replace("/(.*)%comments-rss\\((.*?)\\)%(.*)/i", "\${1}" . $comments_rss_link . "\${3}", $postinfo);
    }
    // Trackback URL
    if (strpos($postinfo_string, '%trackback%') !== FALSE) {
        $trackback_url = trackback_url(FALSE);
        $postinfo = str_replace("%trackback%", $trackback_url, $postinfo);
    }
    // Trackback Link
    if (strpos($postinfo_string, '%trackback-linked(') !== FALSE) {
        $trackback_url = trackback_url(FALSE);
        $trackback_link_text = preg_match("/(.*)%trackback-linked\\('(.*?)'(.*)/i", $postinfo_string, $trackback_matches);
        $trackback_link = '<a href="' . $trackback_url . '">' . $trackback_matches[2] . '</a>';
        // make link nofollow if set in theme options
        if ($bfa_ata['nofollow'] == "Yes") {
            $trackback_link = str_replace('href=', 'rel="nofollow" href=', $trackback_link);
        }
        $postinfo = preg_replace("/(.*)%trackback-linked\\((.*?)\\)%(.*)/i", "\${1}" . $trackback_link . "\${3}", $postinfo);
    }
    // Trackback RDF
    if (strpos($postinfo_string, '%trackback-rdf%') !== FALSE) {
        ob_start();
        trackback_rdf();
        $trackback_rdf = "<!-- " . ob_get_contents() . " -->";
        ob_end_clean();
        $postinfo = str_replace("%trackback-rdf%", $trackback_rdf, $postinfo);
    }
    // Permalink
    if (strpos($postinfo_string, '%permalink%') !== FALSE) {
        ob_start();
        the_permalink();
        $permalink = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%permalink%", $permalink, $postinfo);
    }
    // Post ID
    if (strpos($postinfo_string, '%post-id%') !== FALSE) {
        ob_start();
        the_ID();
        $post_id = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-id%", $post_id, $postinfo);
    }
    // Post Title
    if (strpos($postinfo_string, '%post-title%') !== FALSE) {
        ob_start();
        the_title();
        $post_title = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-title%", $post_title, $postinfo);
    }
    // Edit post
    if (strpos($postinfo_string, '%edit(') !== FALSE) {
        $edit_options = preg_match("/(.*)%edit\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $edit_matches);
        ob_start();
        edit_post_link($edit_matches[4], $edit_matches[2], $edit_matches[6]);
        $edit_link = ob_get_contents();
        ob_end_clean();
        $postinfo = preg_replace("/(.*)%edit\\((.*?)\\)%(.*)/i", "\${1}" . $edit_link . "\${3}", $postinfo);
    }
    // Print
    if (strpos($postinfo_string, '%print(') !== FALSE) {
        $print_text = preg_match("/(.*)%print\\('(.*?)'(.*)/i", $postinfo_string, $print_text_matches);
        $print_link = '<a href="javascript:window.print()">' . $print_text_matches[2] . '</a>';
        $postinfo = preg_replace("/(.*)%print\\((.*?)\\)%(.*)/i", "\${1}" . $print_link . "\${3}", $postinfo);
    }
    // For the "WP-Email" plugin
    if (strpos($postinfo_string, '%wp-email%') !== FALSE) {
        $wp_email = function_exists('wp_email') ? email_link($email_post_text = '', $email_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
    }
    // For the "WP-Print" plugin
    if (strpos($postinfo_string, '%wp-print%') !== FALSE) {
        $wp_print = function_exists('wp_print') ? print_link($print_post_text = '', $print_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
    }
    // For the "WP-PostViews" plugin
    if (strpos($postinfo_string, '%wp-postviews%') !== FALSE) {
        $wp_postviews = function_exists('the_views') ? the_views($display = FALSE) : "";
        $postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
    }
    // For the "WP-PostRatings" plugin
    if (strpos($postinfo_string, '%wp-postratings%') !== FALSE) {
        $wp_postratings = function_exists('the_ratings') ? the_ratings($start_tag = 'span', $custom_id = 0, $display = FALSE) : "";
        $postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
    }
    // For the "Sociable" plugin
    if (strpos($postinfo_string, '%sociable%') !== FALSE) {
        $sociable = (function_exists('sociable_html2') and function_exists('sociable_html')) ? $sociable = sociable_html2() : "";
        $postinfo = str_replace("%sociable%", $sociable, $postinfo);
    }
    // For the "Share This" plugin
    if (strpos($postinfo_string, '%share-this%') !== FALSE) {
        ob_start();
        if (function_exists('sharethis_button')) {
            sharethis_button();
            $share_this = ob_get_contents();
        } else {
            $share_this = "";
        }
        ob_end_clean();
        $postinfo = str_replace("%share-this%", $share_this, $postinfo);
    }
    // Images
    if (strpos($postinfo_string, '<image(') !== FALSE) {
        $postinfo = preg_replace_callback("|<image\\((.*?)\\)>|", "bfa_image_files", $postinfo);
    }
    /* The meta = ALL custom fields:values, formatted by Wordpress as
    	unordered list <ul><li>..</li><li>..</li></ul> */
    if (strpos($postinfo_string, '%meta%') !== FALSE) {
        ob_start();
        the_meta();
        $the_meta = ob_get_contents();
        ob_end_clean();
        // 3.4.3.: remove bfa_ata metas */
        $the_meta = preg_replace("/<li>(.*)bfa_ata(.*)<\\/li>/i", "", $the_meta);
        $postinfo = str_replace("%meta%", $the_meta, $postinfo);
    }
    // Single post meta values, not formatted
    if (strpos($postinfo_string, '%meta(') !== FALSE) {
        $postinfo = preg_replace_callback("|%meta\\('(.*?)'\\)%|", "bfa_meta_value", $postinfo);
    }
    /* PHP code in Post Info Items.
    	But not for WPMU */
    /*removed in 3.4.3. - PHP code works in WPMU too */
    if (strpos($postinfo_string, '<?php ') !== FALSE) {
        ob_start();
        eval('?>' . $postinfo);
        $postinfo = ob_get_contents();
        ob_end_clean();
    }
    return $postinfo;
}
コード例 #10
0
ファイル: single.php プロジェクト: nieyong/nienet_theme
<div id="content">
	<div id="content_head">
		<div class="content_title">
			<h1> <?php the_title(); ?></h1>
		</div>
		<div class="ny_two_column">
			    <div class="ny_column column_first">
				    <p>
					    <strong>简介:</strong><?php the_excerpt(); ?>
				    </p>
			    </div>
			    <div class="ny_column column_second">
				    <p>
					<strong>发布日期:</strong><?php the_time('F j, Y'); ?><br />
					<strong>关于作者:</strong><?php the_modified_author(); ?><?php the_author_description(); ?><br />
					<strong>技术主题:</strong><?php the_category(', ') ?>
				    </p>

			    </div>
		</div>
	</div>



	<div id="contentleft">
	
		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

		<?php the_content(__('Read more'));?><div style="clear:both;"></div>