Exemplo n.º 1
0
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 
}
Exemplo n.º 2
0
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>";
}
Exemplo n.º 3
0
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');
}
Exemplo n.º 4
0
/**
 *
 * 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();
}
 * '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 {
Exemplo n.º 6
0
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;
    }
}
Exemplo n.º 7
0
function theme_get_comments()
{
    if (!theme_get_option('theme_allow_comments')) {
        return '';
    }
    theme_ob_start();
    comments_template();
    return theme_ob_get_clean();
}
Exemplo n.º 8
0
function theme_search()
{
    theme_ob_start();
    get_search_form();
    return theme_ob_get_clean();
}