• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP theme_ob_start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: theme_post_wrapper

function theme_post_wrapper($args = '')
{
    $args = wp_parse_args($args, array('id' => '', 'class' => '', 'title' => '', 'heading' => 'h2', 'thumbnail' => '', 'before' => '', 'content' => '', 'after' => ''));
    extract($args);
    if (theme_is_empty_html($title) && theme_is_empty_html($content)) {
        return;
    }
    if ($id) {
        $id = ' id="' . $id . '" ';
    }
    if ($class) {
        $class = ' ' . $class;
    }
    ?>
	<article<?php 
    echo $id;
    ?>
 class="art-post art-article <?php 
    echo $class;
    ?>
">
                                <?php 
    theme_ob_start();
    ?>
                                        <?php 
    if (!theme_is_empty_html($title)) {
        echo '<' . $heading . ' class="art-postheader"><span class="art-postheadericon">' . $title . '</span></' . $heading . '>';
    }
    ?>
                                                            <?php 
    echo $before;
    ?>
                                    <?php 
    $meta = trim(theme_ob_get_clean());
    if (strlen($meta) > 0) {
        echo '<div class="art-postmetadataheader">' . $meta . '</div>';
    }
    ?>
                                <?php 
    echo $thumbnail;
    ?>
<div class="art-postcontent clearfix"><?php 
    echo $content;
    ?>
</div>
                                <?php 
    theme_ob_start();
    ?>
                                        <?php 
    echo $after;
    ?>
                                    <?php 
    $meta = trim(theme_ob_get_clean());
    if (strlen($meta) > 0) {
        echo '<div class="art-postmetadatafooter">' . $meta . '</div>';
    }
    ?>
                </article>
	<?php 
}
开发者ID:AlexandrTalala,项目名称:site-2,代码行数:60,代码来源:wrappers.php


示例2: theme_get_metadata_icons

function theme_get_metadata_icons($icons = '', $class = '')
{
    global $post;
    if (!is_string($icons) || theme_strlen($icons) == 0) {
        return;
    }
    $icons = explode(",", str_replace(' ', '', $icons));
    if (!is_array($icons) || count($icons) == 0) {
        return;
    }
    $result = array();
    for ($i = 0; $i < count($icons); $i++) {
        $icon = $icons[$i];
        switch ($icon) {
            case 'date':
                $result[] = '<span class="mmb-postdateicon">' . sprintf(__('<span class="%1$s"></span> %2$s', THEME_NS), 'date', sprintf('<span class="entry-date" title="%1$s">%2$s</span>', esc_attr(get_the_time()), get_the_date())) . '</span>';
                break;
            case 'author':
                $result[] = '<span class="mmb-postauthoricon">' . sprintf(__('<span class="%1$s">By</span> %2$s', THEME_NS), 'author', sprintf('<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', get_author_posts_url(get_the_author_meta('ID')), sprintf(esc_attr(__('View all posts by %s', THEME_NS)), get_the_author()), get_the_author())) . '</span>';
                break;
            case 'category':
                $categories = get_the_category_list(', ');
                if (theme_strlen($categories) == 0) {
                    break;
                }
                $result[] = '<span class="mmb-postcategoryicon">' . sprintf(__('<span class="%1$s">Posted in</span> %2$s', THEME_NS), 'categories', get_the_category_list(', ')) . '</span>';
                break;
            case 'tag':
                $tags_list = get_the_tag_list('', ', ');
                if (!$tags_list) {
                    break;
                }
                $result[] = '<span class="mmb-posttagicon">' . sprintf(__('<span class="%1$s">Tagged</span> %2$s', THEME_NS), 'tags', $tags_list) . '</span>';
                break;
            case 'comments':
                if (!comments_open() || !theme_get_option('theme_allow_comments')) {
                    break;
                }
                theme_ob_start();
                comments_popup_link(__('Leave a comment', THEME_NS), __('1 Comment', THEME_NS), __('% Comments', THEME_NS));
                $result[] = '<span class="mmb-postcommentsicon">' . theme_ob_get_clean() . '</span>';
                break;
            case 'edit':
                if (!current_user_can('edit_post', $post->ID)) {
                    break;
                }
                theme_ob_start();
                edit_post_link(__('Edit', THEME_NS), '');
                $result[] = '<span class="mmb-postediticon">' . theme_ob_get_clean() . '</span>';
                break;
        }
    }
    $result = implode(theme_get_option('theme_metadata_separator'), $result);
    if (theme_is_empty_html($result)) {
        return;
    }
    return "<div class=\"mmb-post{$class}icons mmb-metadata-icons\">{$result}</div>";
}
开发者ID:JordiCruells,项目名称:mwt,代码行数:58,代码来源:functions.php


示例3: theme_get_dynamic_sidebar_data

function theme_get_dynamic_sidebar_data($sidebar_id)
{
    global $theme_widget_args, $theme_sidebars;
    $sidebar_style = theme_get_option('theme_sidebars_style_' . $theme_sidebars[$sidebar_id]['group']);
    theme_ob_start();
    $success = dynamic_sidebar($sidebar_id);
    $content = theme_ob_get_clean();
    if (!$success) {
        return false;
    }
    extract($theme_widget_args);
    $data = explode($after_widget, $content);
    $widgets = array();
    $heading = theme_get_option('theme_' . (is_home() ? 'posts' : 'single') . '_widget_title_tag');
    for ($i = 0; $i < count($data); $i++) {
        $widget = $data[$i];
        if (theme_is_empty_html($widget)) {
            continue;
        }
        $id = null;
        $name = null;
        $class = null;
        $style = $sidebar_style;
        $title = null;
        if (preg_match('/<widget(.*?)>/', $widget, $matches)) {
            if (preg_match('/id="(.*?)"/', $matches[1], $ids)) {
                $id = $ids[1];
            }
            if (preg_match('/name="(.*?)"/', $matches[1], $names)) {
                $name = $names[1];
            }
            if (preg_match('/class="(.*?)"/', $matches[1], $classes)) {
                $class = $classes[1];
            }
            if ($name) {
                $style = theme_get_widget_style($name, $style);
            }
            $widget = preg_replace('/<widget[^>]+>/', '', $widget);
            if (preg_match('/<title>(.*)<\\/title>/', $widget, $matches)) {
                $title = $matches[1];
                $widget = preg_replace('/<title>.*?<\\/title>/', '', $widget);
            }
        }
        $widgets[] = array('id' => $id, 'name' => $name, 'class' => $class, 'style' => $style, 'title' => $title, 'heading' => $heading, 'content' => $widget);
    }
    return array_filter($widgets, 'theme_is_displayed_widget');
}
开发者ID:Wickwood-LLC,项目名称:trlf-artisteer,代码行数:47,代码来源:sidebars.php


示例4: theme_get_smilies_js

/**
 *
 * smiley.php
 *
 * Used to add custom shortcodes.
 * 
 * The smilies template. Used to output smilies in post comments.
 * To enable Smilies please go to the WordPress Admin panel -> Appearance -> Theme Options -> Comments -> Use smilies in comments.
 * 
 * More detailed information about smilies: http://codex.wordpress.org/Using_Smilies
 * 
 */
function theme_get_smilies_js()
{
    theme_ob_start();
    ?>

<script type="text/javascript" language="javascript">
/* <![CDATA[ */
	function grin(tag) {
		var myField;
		tag = ' ' + tag + ' ';
		if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
			myField = document.getElementById('comment');
		} else {
			return false;
		}
		if (document.selection) {
			myField.focus();
			sel = document.selection.createRange();
			sel.text = tag;
			myField.focus();
		}
		else if (myField.selectionStart || myField.selectionStart == '0') {
			var startPos = myField.selectionStart;
			var endPos = myField.selectionEnd;
			var cursorPos = endPos;
			myField.value = myField.value.substring(0, startPos)
				+ tag
				+ myField.value.substring(endPos, myField.value.length);
			cursorPos += tag.length;
			myField.focus();
			myField.selectionStart = cursorPos;
			myField.selectionEnd = cursorPos;
		}
		else {
			myField.value += tag;
			myField.focus();
		}
	}
/* ]]> */
</script>
	<?php 
    return theme_ob_get_clean();
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:55,代码来源:smiley.php


示例5: get_permalink

 * 'after' - post footer metadata
 * 
 * To create a new custom post format template you must create a file "content-YourTemplateName.php"
 * Then copy the contents of the existing content.php into your file and edit it the way you want.
 * 
 * Change an existing get_template_part() function as follows:
 * get_template_part('content', 'YourTemplateName');
 *
 */
global $post;
/* Display navigation to next/previous pages when applicable */
if (!empty($post->post_parent)) {
    $return_link = '<a href="' . get_permalink($post->post_parent) . '" title="' . esc_attr(sprintf(__('Return to %s', THEME_NS), strip_tags(get_the_title($post->post_parent)))) . '" rel="gallery">' . sprintf(__('<span class="meta-nav">&larr;</span> %s', THEME_NS), get_the_title($post->post_parent)) . '</a>';
    theme_post_navigation(array('next_link' => $return_link));
}
theme_ob_start();
if (wp_attachment_is_image()) {
    $attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')));
    foreach ($attachments as $k => $attachment) {
        if ($attachment->ID == $post->ID) {
            break;
        }
    }
    $k++;
    $next_attachment_url = '';
    // If there is more than 1 image attachment in a gallery
    if (count($attachments) > 1) {
        if (isset($attachments[$k])) {
            // get the URL of the next image attachment
            $next_attachment_url = get_attachment_link($attachments[$k]->ID);
        } else {
开发者ID:spadwen,项目名称:shop.bentleigh-discount-lolly.com.au,代码行数:31,代码来源:content-attachment.php


示例6: theme_comment

function theme_comment($comment, $args, $depth)
{
    $GLOBALS['comment'] = $comment;
    switch ($comment->comment_type) {
        case '':
            ?>
			<li <?php 
            comment_class();
            ?>
 id="li-comment-<?php 
            comment_ID();
            ?>
">
				<?php 
            theme_ob_start();
            ?>
				<div class="comment-author vcard">
				<?php 
            echo theme_get_avatar(array('id' => $comment, 'size' => 48));
            ?>
				<?php 
            printf(__('%s <span class="says">says:</span>', THEME_NS), sprintf('<cite class="fn">%s</cite>', get_comment_author_link()));
            ?>
				</div>
				<?php 
            if ($comment->comment_approved == '0') {
                ?>
					<em><?php 
                _e('Your comment is awaiting moderation.', THEME_NS);
                ?>
</em>
					<br />
				<?php 
            }
            ?>

				<div class="comment-meta commentmetadata"><a href="<?php 
            echo esc_url(get_comment_link($comment->comment_ID));
            ?>
">
				<?php 
            printf(__('%1$s at %2$s', THEME_NS), get_comment_date(), get_comment_time());
            ?>
</a><?php 
            edit_comment_link(__('(Edit)', THEME_NS), ' ');
            ?>
				</div>

				<div class="comment-body"><?php 
            comment_text();
            ?>
</div>

				<div class="reply">
				<?php 
            comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])));
            ?>
				</div>
				<?php 
            theme_post_wrapper(array('content' => theme_ob_get_clean(), 'id' => 'comment-' . get_comment_ID()));
            ?>


				<?php 
            break;
        case 'pingback':
        case 'trackback':
            ?>
			<li class="post pingback">
			<?php 
            theme_ob_start();
            ?>
				<p><?php 
            _e('Pingback:', THEME_NS);
            ?>
 <?php 
            comment_author_link();
            edit_comment_link(__('(Edit)', THEME_NS), ' ');
            ?>
</p>
			<?php 
            theme_post_wrapper(array('content' => theme_ob_get_clean(), 'class' => $comment->comment_type));
            break;
    }
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:85,代码来源:functions.php


示例7: theme_get_comments

function theme_get_comments()
{
    if (!theme_get_option('theme_allow_comments')) {
        return '';
    }
    theme_ob_start();
    comments_template();
    return theme_ob_get_clean();
}
开发者ID:epiii,项目名称:Clean-Wordpress-theme,代码行数:9,代码来源:functions.php


示例8: theme_search

function theme_search()
{
    theme_ob_start();
    get_search_form();
    return theme_ob_get_clean();
}
开发者ID:slavam,项目名称:adult-childhood,代码行数:6,代码来源:shortcodes.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP theme_option函数代码示例发布时间:2022-05-23
下一篇:
PHP theme_ob_get_clean函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap