コード例 #1
0
    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        /* Our variables from the widget settings. */
        $comment_phrase = $instance['comment_phrase'];
        $comment_id = $instance['comment_id'];
        $comment = get_comment($comment_id);
        if (!$comment) {
            ?>
		<!-- Note, MBU: Featured Comment Widget not shown. No comment to display -->
		<?php 
        } else {
            $author = '<cite>' . $comment->comment_author . '</cite>';
            $artwork_post = get_post($comment->comment_post_ID);
            $post_link = '<a href="' . get_post_permalink($comment->comment_post_ID) . '" title="' . $artwork_post->post_title . '" >' . $artwork_post->post_title . '</a>';
            $comment_phrase_replaced = str_replace('#author#', $author, $comment_phrase);
            $comment_phrase_replaced = str_replace('#title#', $post_link, $comment_phrase_replaced);
            /* Before widget (defined by themes). */
            echo $before_widget;
            ?>
			<div id="featured-comment" >
				<blockquote>
				 <?php 
            echo $comment->comment_content;
            ?>
				</blockquote>
				<div class="grid_2">
				<?php 
            echo mbudm_get_post_image($comment->comment_post_ID, 'artwork-2', true, '');
            ?>
				</div>
				<p>
				<?php 
            echo $comment_phrase_replaced;
            ?>
				</p>
			</div>
			<?php 
            /* After widget (defined by themes). */
            echo $after_widget;
        }
    }
コード例 #2
0
ファイル: functions.php プロジェクト: mbudm/artpro
function mbudm_artwork_order()
{
    // verify this came from the our screen and with proper authorization,
    // because save_post can be triggered at other times
    if (isset($_POST['action']) && $_POST['action'] == "reorder_artwork") {
        if (!wp_verify_nonce($_POST['_wpnonce'], 'reorder_artwork')) {
            wp_die(__('You do not have sufficient permissions to access this page.', TEMPLATE_DOMAIN));
        } else {
            //process submitted artwork order
            $args = array('taxonomy' => 'category', 'orderby' => 'name', 'order' => 'ASC');
            $categories = get_categories($args);
            foreach ($categories as $category) {
                if (isset($_POST['mb_artwork_order_cat_' . $category->cat_ID])) {
                    $cat_meta = get_option("taxonomy_" . $category->cat_ID);
                    $cat_meta['cat_artwork_order'] = $_POST['mb_artwork_order_cat_' . $category->cat_ID];
                    update_option("taxonomy_" . $category->cat_ID, $cat_meta);
                }
            }
        }
    }
    // Is the user allowed to edit the post or page?
    if (!current_user_can('update_themes')) {
        wp_die(__('You do not have sufficient permissions to access this page.', TEMPLATE_DOMAIN));
    }
    // OK, we're authenticated: we need to find and save the data
    // We'll put it into an array to make it easier to loop though.
    ?>
	 <div class="wrap" id="artwork-order">
	 <h2><?php 
    _e('Manage Artwork Order', TEMPLATE_DOMAIN);
    ?>
</h2>
	 <?php 
    $args = array('taxonomy' => 'category', 'orderby' => 'name', 'order' => 'ASC');
    $categories = get_categories($args);
    $catfields = '';
    foreach ($categories as $category) {
        $cat_meta = get_option("taxonomy_" . $category->cat_ID);
        $catfields .= '<input type="hidden" name="mb_artwork_order_cat_' . $category->cat_ID . '" value="' . $cat_meta['cat_artwork_order'] . '" />';
        $saved_order = explode(",", $cat_meta['cat_artwork_order']);
        echo '<div>';
        echo '<h3>' . $category->name . '</h3>';
        $alist_args = array('tax_query' => array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category->cat_ID)), 'post_type' => 'mbudm_artwork', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC');
        // The Query
        $the_alist_query = new WP_Query($alist_args);
        if ($the_alist_query->post_count > 0) {
            $msg = count($saved_order) . ' - ' . $the_alist_query->post_count . ' | ';
            $output = $msg . '<ul id="mb_artwork_order_cat_' . $category->cat_ID . '" >';
            //use saved order if it is the same count()
            if (count($saved_order) == $the_alist_query->post_count) {
                foreach ($saved_order as $aid) {
                    $output .= '<li id="mb_artwork_' . $aid . '" >' . mbudm_get_post_image($aid, MBUDM_IMAGESIZE_2, false) . '</li>';
                }
            } else {
                // The Loop
                while ($the_alist_query->have_posts()) {
                    $the_alist_query->the_post();
                    $output .= '<li id="mb_artwork_' . get_the_id() . '" >' . mbudm_get_post_image(get_the_id(), MBUDM_IMAGESIZE_2, false) . '</li>';
                }
                // Reset Post Data
                wp_reset_postdata();
            }
            $output .= '</ul>';
        } else {
            $output = '<p>There are no artworks in this category.</p>';
        }
        echo $output;
        echo '</div>';
    }
    ?>
		<form name='reorder_artwork' id='reorder_artwork' method='post' action='' >
			<input type='hidden' name='action' value='reorder_artwork' />
			<input type='hidden' name='_wpnonce' value='<?php 
    echo wp_create_nonce('reorder_artwork');
    ?>
' />
			<?php 
    echo $catfields;
    ?>
	 <p class="submit">
		<input type="submit" class="button-primary" value="Update Artwork Order" />
	 </p>
	 </div>
	 <?php 
}
コード例 #3
0
ファイル: functions.php プロジェクト: mbudm/artpro
function mb_featured_image($image_size = null)
{
    global $post;
    if (has_post_thumbnail()) {
        if ($image_size == null) {
            $image_size = MBUDM_IMAGESIZE_THUMB_6;
        }
        //echo '<div class="post-thumb grid_6" >' . mbudm_get_post_image($post->ID,MBUDM_IMAGESIZE_THUMB_6,true) . '</div>';
        echo mbudm_get_post_image($post->ID, $image_size, true);
    }
}
コード例 #4
0
ファイル: featured_artwork.php プロジェクト: mbudm/artpro
        $classes = $display_mode . " container_24";
        break;
    case MBUDM_HERO_SWIPER:
        $image_size = MBUDM_IMAGESIZE_BANNER;
        $classes = $display_mode;
        break;
}
$sticky_array = get_option('sticky_posts');
$args = array('post__in' => $sticky_array, 'post_type' => MBUDM_PT_ARTWORK, 'orderby' => 'rand');
$query = new WP_Query($args);
if ($query->have_posts()) {
    ?>
<ul class="<?php 
    echo $classes;
    ?>
" ><?php 
    while ($query->have_posts()) {
        $query->the_post();
        $fp_id = get_the_ID();
        ?>
<li>
	<?php 
        echo mbudm_get_post_image($fp_id, $image_size, true);
        ?>
	</li><?php 
    }
    ?>
</ul>
<?php 
}
wp_reset_query();
コード例 #5
0
ファイル: category.php プロジェクト: mbudm/artpro
            }
            ?>
"><?php 
            echo mbudm_get_post_image($aid, $img_size, true);
            ?>
</li><?php 
        }
    } else {
        while ($the_alist_query->have_posts()) {
            $the_alist_query->the_post();
            ?>
<li class="<?php 
            echo $li_class;
            ?>
"><?php 
            echo mbudm_get_post_image(get_the_ID(), $img_size, true);
            ?>
</li><?php 
        }
        // Reset Post Data
        wp_reset_postdata();
    }
    ?>
</ul>
					</section>
			<?php 
} else {
    ?>

				<article id="post-0" class="post no-results not-found container_24">
					<header>
コード例 #6
0
ファイル: artwork_list.php プロジェクト: mbudm/artpro
        $grid_class = '';
        break;
    case MBUDM_IMAGESIZE_20:
    case MBUDM_IMAGESIZE_18:
    case MBUDM_IMAGESIZE_16:
    case MBUDM_IMAGESIZE_12:
    case MBUDM_IMAGESIZE_8:
    case MBUDM_IMAGESIZE_6:
    case MBUDM_IMAGESIZE_4:
    case MBUDM_IMAGESIZE_3:
    case MBUDM_IMAGESIZE_2:
    case MBUDM_IMAGESIZE_1:
        $grid_num = str_replace(MBUDM_IMAGESIZE_PREFIX, "", $thumb_size);
        $grid_class = 'grid_' . $grid_num[0];
        break;
}
foreach ($query as $artwork) {
    ?>
	<li class="<?php 
    echo $grid_class;
    ?>
">
			<?php 
    echo mbudm_get_post_image($artwork->ID, $thumb_size, true, '');
    ?>
    </li>
<?php 
}
?>
</ul>