コード例 #1
6
ファイル: our-mission.php プロジェクト: kautzar/drpp4
function charity_vc_our_mission($atts, $content = null)
{
    extract(shortcode_atts(array('our_mission' => ''), $atts));
    $page_id = get_page_by_title($our_mission);
    $missionQuery = new WP_Query(array("page_id" => $page_id->ID));
    if ($missionQuery->have_posts()) {
        $missionQuery->the_post();
        $url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
        ?>
        <!-- Save Lives Section Start Here-->
        <section class="save-lives text-center parallax" style="background-image: url('<?php 
        echo esc_url($url[0]);
        ?>
')">
            <div class="container">
                <div class="row">
                    <div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
                        <header class="page-header">
                            <h2><?php 
        the_title();
        ?>
</h2>
                            <?php 
        the_content();
        ?>
                        </header>
                    </div>
                </div>
            </div>
        </section>
        <!-- Save Lives Section Start Here-->
    <?php 
    }
    wp_reset_postdata();
}
コード例 #2
2
 function do_x_post_password_cb()
 {
     //snag from wp-login.php:386-393
     require_once ABSPATH . 'wp-includes/class-phpass.php';
     // By default, use the portable hash from phpass
     $wp_hasher = new PasswordHash(8, true);
     // 10 days
     setcookie('wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword(stripslashes($_POST['pass'])), time() + 864000, COOKIEPATH);
     //fake it so it's available in the loop below
     $_COOKIE['wp-postpass_' . COOKIEHASH] = $wp_hasher->HashPassword(stripslashes($_POST['pass']));
     $q = new WP_Query("p={$_POST['pid']}");
     if ($q->have_posts()) {
         while ($q->have_posts()) {
             $q->the_post();
             // verifies password hash
             if (post_password_required()) {
                 wp_send_json_error('Invalid password');
             }
             // get post title
             ob_start();
             the_title(sprintf('<a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a>');
             $title = ob_get_clean();
             // get post content
             ob_start();
             the_content();
             $content = ob_get_clean();
         }
     }
     wp_reset_postdata();
     $return = array('title' => $title, 'content' => $content);
     wp_send_json_success($return);
 }
コード例 #3
0
    function widget($args, $instance)
    {
        extract($args);
        $countt = apply_filters('widget_guanzhu_sina', empty($instance['countt']) ? __('nothing') : $instance['countt']);
        //小工具前台标题
        echo $before_widget;
        echo '<i class="iconfont iconfont-siadebar">&#xe609</i>
					<h3 class="widget-title">
						热门文章
					</h3>
					<div class="widget-main widget-main-hot">
						<ul>';
        if (intval($countt) <= 10) {
            $popular = new WP_Query('orderby=comment_count&posts_per_page=' . $countt);
            $count_di = 1;
            while ($popular->have_posts()) {
                $popular->the_post();
                echo '<li><span>' . $count_di . '</span>' . '<a href="';
                the_permalink();
                echo '">';
                the_title();
                echo '</a></li>';
                $count_di++;
            }
        }
        echo '</ul>';
        echo '</div>';
        echo $after_widget;
    }
コード例 #4
0
ファイル: widgets.php プロジェクト: TailoredMarketing/uPrint
    public function widget($args, $instance)
    {
        ?>
			<?php 
        echo $args['before_widget'];
        ?>
			<?php 
        echo $args['before_title'];
        echo $instance['title'];
        echo $args['after_title'];
        ?>
            <div class="list-group">
			<?php 
        $arg = array('posts_per_page' => 5, 'post_type' => 'post', 'orderby' => 'date', 'order' => 'DESC');
        $newposts = new WP_Query($arg);
        while ($newposts->have_posts()) {
            $newposts->the_post();
            ?>
			  <a class="list-group-item" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
			<?php 
        }
        wp_reset_postdata();
        ?>
			</div>
            <?php 
        echo $args['after_widget'];
        ?>
        <?php 
    }
コード例 #5
0
ファイル: functions.php プロジェクト: jrock89/JRockWeb2
function featureText()
{
    if (is_front_page()) {
        the_field('feature_text');
    } elseif (is_home() || is_single()) {
        _e('Rock Theme Official Blog');
    } elseif (is_archive()) {
        _e('Rock Theme Official Blog');
        _e('<br>');
        single_term_title('Browsing: ');
        if (is_month()) {
            $monthNum = get_query_var('monthnum');
            $month = date('F', mktime(0, 0, 0, $monthNum));
            $year = get_query_var('year');
            echo 'Posts from ' . $month . ' ' . $year;
        }
    } elseif (is_page_template('page-news.php') || is_page_template('page-about.php') || is_page_template('page-contact.php')) {
        bloginfo('name');
        _e('<br>');
        the_title();
    } elseif (is_404()) {
        _e('Whoops, were a little lost.');
    } elseif (is_search()) {
        _e('Rock Theme Official Blog');
        _e('<br>');
        printf('Search results for: %s', get_search_query());
    }
}
コード例 #6
0
function most_viewed()
{
    ob_start();
    $posts = wmp_get_popular(array('limit' => 4, 'post_type' => 'paper', 'range' => 'all_time'));
    global $post;
    if (count($posts) > 0) {
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
		<li><a href="<?php 
            the_permalink();
            ?>
">
			<?php 
            if (get_field('short_title')) {
                the_field('short_title');
            } else {
                the_title();
            }
            ?>
		</a></li>
		<?php 
        }
    }
    wp_reset_query();
    $contents = ob_get_contents();
    ob_end_clean();
    return $contents;
}
コード例 #7
0
 function magee_breadcrumb($options = "")
 {
     $this->options = array('before' => '<span class="arrow"> ', 'after' => ' </span>', 'delimiter' => ' / ');
     if (is_array($options)) {
         $this->options = array_merge($this->options, $options);
     }
     $markup = $this->options['before'] . $this->options['delimiter'] . $this->options['after'];
     global $post;
     echo '<p class="magee-breadcrumb"><a href="' . get_bloginfo('url') . '">';
     _e("Home", 'magee');
     echo "</a>";
     if (!is_front_page()) {
         echo $markup;
     }
     $output = $this->magee_simple_breadcrumb_case($post);
     echo "<span class='current_crumb'>";
     if (is_page() || is_single()) {
         if (is_front_page()) {
             echo $markup;
             the_title();
         } else {
             the_title();
         }
     } else {
         echo $output;
     }
     echo " </span></p>";
 }
コード例 #8
0
    function form($instance)
    {
        ?>
        <p><label for="<?php 
        echo $this->get_field_id('ewic_shortcode');
        ?>
">Select your Slider name and hit save button.<br />
    <select id="<?php 
        echo $this->get_field_id('ewic_shortcode');
        ?>
" name="<?php 
        echo $this->get_field_name('ewic_shortcode');
        ?>
" >
	<?php 
        global $post;
        $args = array('post_type' => 'easyimageslider', 'order' => 'ASC', 'posts_per_page' => -1, 'post_status' => 'publish');
        $myposts = get_posts($args);
        foreach ($myposts as $post) {
            setup_postdata($post);
            echo '<option value=' . $post->ID . '' . selected($instance["ewic_shortcode"], $post->ID) . '>' . esc_html(esc_js(the_title(NULL, NULL, FALSE))) . '</option>';
        }
        ?>
</select></label></p>
        <?php 
    }
コード例 #9
0
function show_faq($atts)
{
    ob_start();
    $secondary_query = new WP_Query(array('post_type' => 'questions', 'posts_per_page' => $atts[limit], 'tax_query' => array(array('taxonomy' => 'faq', 'field' => 'slug', 'terms' => $atts[category], 'operator' => 'IN'))));
    if ($secondary_query->have_posts()) {
        while ($secondary_query->have_posts()) {
            $secondary_query->the_post();
            echo '
								<div class="row">
									<div class="col-lg-8 col-lg-offset-2 centered">
							';
            the_post();
            the_post_thumbnail('thumbnail');
            the_title('<h1>', '</h1>');
            the_content();
            echo '
									</div>
								</div>
							';
        }
        // end while
    }
    // end if
    wp_reset_postdata();
    return ob_get_clean();
}
コード例 #10
0
function mdwpbp_related_posts()
{
    global $post;
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
        foreach ($tags as $tag) {
            $tag_arr = $tag->slug . ',';
        }
        $args = array('tag' => $tag_arr, 'numberposts' => 5, 'post__not_in' => array($post->ID));
        $related_posts = get_posts($args);
        if ($related_posts) {
            echo '<p class="related-posts-header">Related Posts</p><ul id="mdwpbp-related-posts">';
            foreach ($related_posts as $post) {
                setup_postdata($post);
                echo '<li class="related-post"><a href="';
                the_permalink();
                echo '">';
                the_title();
                echo '</a></li>';
            }
            echo '</ul>';
        }
    }
    // if ($tags)
    wp_reset_postdata();
}
コード例 #11
0
ファイル: featured_video.php プロジェクト: annguyenit/getdeal
        function widget($args, $instance)
        {
            // prints the widget
            extract($args, EXTR_SKIP);
            echo $before_widget;
            $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
            $category = empty($instance['category']) ? '' : apply_filters('widget_category', $instance['category']);
            $post_type = empty($instance['post_type']) ? 'post' : apply_filters('widget_post_type', $instance['post_type']);
            $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']);
            ?>
			<div class="featured_video">		
			<?php 
            if ($title) {
                ?>
<h3 class="clearfix"> <?php 
                echo $title;
                ?>
</h3><?php 
            }
            ?>
            <?php 
            global $post;
            $args = '';
            if ($category) {
                $args .= '&category=' . $category;
            }
            $latest_menus = get_posts('numberposts=' . $post_number . $args . '&post_type=' . $post_type);
            foreach ($latest_menus as $post) {
                setup_postdata($post);
                if (get_post_meta($post->ID, 'video', true) || get_post_meta($post->ID, 'Video', true) || get_post_meta($post->ID, 'VIDEO', true)) {
                    if (get_post_meta($post->ID, 'video', true)) {
                        $video = get_post_meta($post->ID, 'video', true);
                    } elseif (get_post_meta($post->ID, 'Video', true)) {
                        $video = get_post_meta($post->ID, 'Video', true);
                    } elseif (get_post_meta($post->ID, 'VIDEO', true)) {
                        $video = get_post_meta($post->ID, 'VIDEO', true);
                    }
                    ?>
                 <div class="video">
                <?php 
                    echo $video;
                    ?>
                    <h4><a class="widget-title" href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
 </a></h4>
                </div>
                <?php 
                }
                ?>
             <?php 
            }
            ?>
             </div>
            <?php 
            echo $after_widget;
        }
コード例 #12
0
function post_excerpts_here()
{
    //posts with date, author, time, content excerpts, and title..
    if (have_posts()) {
        while (have_posts()) {
            echo '<div class="excerpt-div">';
            the_post();
            echo '<h2 class="post-title"><a href="';
            the_permalink();
            echo '" title="';
            the_title();
            echo '">';
            the_title();
            echo '</a></h2>';
            echo '<h4 class="post-info">';
            echo 'Created on ';
            the_date();
            echo ' at ';
            the_time();
            echo ' by ';
            the_author_meta(first_name);
            echo '.</h4>';
            echo '<p class="post-excerpt">';
            the_excerpt();
            echo '</p>';
            echo '</div>';
        }
        // end while
    }
    // end if
}
コード例 #13
0
ファイル: ci_widget_post_type.php プロジェクト: axxe16/bst
        function widget($args, $instance)
        {
            extract($args);
            $ci_post_id = $instance['postid'];
            $post_type_name = $instance['post_type_name'];
            if (empty($ci_post_id) or empty($post_type_name)) {
                return;
            }
            $q = new WP_Query(array('post_type' => $post_type_name, 'p' => $ci_post_id));
            echo $before_widget;
            $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
            while ($q->have_posts()) {
                $q->the_post();
                global $post;
                if (get_post_type() == 'testimonial') {
                    ?>
					<blockquote class="testimonial">
						<i class="fa fa-quote-left"></i>
						<?php 
                    the_content();
                    ?>
						<cite><?php 
                    the_title();
                    ?>
</cite>
					</blockquote>
				<?php 
                } else {
                    ci_get_template_part('loop', 'item', array('title' => $title));
                }
            }
            wp_reset_postdata();
            echo $after_widget;
        }
コード例 #14
0
function mvm_display_singer_list()
{
    $args = array('post_type' => 'singer', 'posts_per_page' => -1, 'post_status' => 'published');
    $singers = new WP_Query($args);
    if ($singers->have_posts()) {
        ?>
		<ul class="mvm_singers_list">
		<?php 
        while ($singers->have_posts()) {
            $singers->the_post();
            ?>
			<li id="singer-<?php 
            the_id();
            ?>
" class="mvm_singer" singer-id="<?php 
            the_id();
            ?>
">
				<?php 
            the_title();
            ?>
			</li>
		<?php 
        }
        wp_reset_postdata();
        ?>
		</ul>
	<?php 
    }
}
コード例 #15
0
/**
 * Adds HTML to the bottom of the Beaver Builder Page Builder interface, which is used in a
 * modal to allow content blocks to be added to the page.
 */
function tesseract_add_button_to_page_builder()
{
    if (!defined('DOING_AJAX')) {
        if (!FLBuilderModel::is_builder_active()) {
            return;
        }
    }
    $templates_query = new WP_Query(array('post_type' => 'fl-builder-template', 'meta_key' => Tesseract_Importer_Constants::$CONTENT_BLOCK_META_KEY, 'meta_value' => 1, 'posts_per_page' => 999));
    ?>
		<div id="tesseract-content-blocks-wrapper">
			<div class="cancel-wrapper">
				<span class="fl-builder-blocks-update fl-builder-button fl-builder-button-primary fl-builder-button-large pull-left"><i class="fa fa-refresh"></i></span>
				<span class="fl-builder-blocks-update-message pull-left"></span>
				<span class="fl-builder-cancel-button fl-builder-button fl-builder-button-primary fl-builder-button-large">Cancel</span>
			</div>
			<?php 
    while ($templates_query->have_posts()) {
        $templates_query->the_post();
        ?>
				<?php 
        $template_id = get_the_ID();
        ?>
				<?php 
        global $post;
        $slug = $post->post_name;
        ?>
				<div class="content-block slug-<?php 
        echo esc_attr($slug);
        ?>
"
					style="background-image: url('<?php 
        echo esc_attr(get_stylesheet_directory_uri());
        ?>
/images/content-blocks/<?php 
        echo esc_attr($slug);
        ?>
.jpg')">
					<a href="#" class="append-content-button" data-template-id="<?php 
        echo esc_attr($template_id);
        ?>
">
						<?php 
        the_title();
        ?>
					</a>
				</div>
			<?php 
    }
    ?>
			<div class="cancel-wrapper">
				<span class="fl-builder-blocks-update fl-builder-button fl-builder-button-primary fl-builder-button-large pull-left"><i class="fa fa-refresh"></i></span>
				<span class="fl-builder-blocks-update-message pull-left"></span>
				<span class="fl-builder-cancel-button fl-builder-button fl-builder-button-primary fl-builder-button-large">Cancel</span>
			</div>
		</div>
	<?php 
    if (defined('DOING_AJAX') && DOING_AJAX) {
        die;
    }
}
コード例 #16
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        echo $before_widget;
        $a = array("orderby" => "id", "order" => "asc");
        $categories = get_categories($a);
        foreach ($categories as $category) {
            echo $before_title;
            // var_dump($category);
            echo "<h2>" . $category->name . "</h2><ul>";
            global $post;
            $args = array('category' => $category->term_id, "numberposts" => -1, "orderby" => "title", "order" => "ASC");
            $myposts = get_posts($args);
            foreach ($myposts as $post) {
                setup_postdata($post);
                ?>
<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li><?php 
            }
            echo "</ul>";
            wp_reset_query();
            echo $after_title;
        }
        echo $after_widget;
    }
コード例 #17
0
function tpp_posts_widget()
{
    $tpp_posts_query = new WP_Query();
    $tpp_posts_query->get_posts();
    ?>
	<h3>Posts on this page:</h3>
	<?php 
    if ($tpp_posts_query->have_posts()) {
        while ($tpp_posts_query->have_posts()) {
            $tpp_posts_query->the_post();
            ?>
	<a href="<?php 
            echo the_permalink();
            ?>
"
		title="<?php 
            echo the_title();
            ?>
"><?php 
            echo the_title();
            ?>
</a>
		(<?php 
            echo comments_number();
            ?>
)
	<?php 
        }
    }
    ?>
	<?php 
}
コード例 #18
0
function sd_custom_product_title()
{
    ?>

	<!-- Home header section -->
	<div id="order__intro--product">
			
		<section id="order__intro__section">

			<!-- Home header subtitle -->
			<h2 class="page__subtitle">Quality targeted human visitors</h2>

			<!-- Home header title -->
			<h1 class="page__title"><?php 
    the_title();
    ?>
</h1>

			<!-- Home header content -->

			<div class="steps__frame">
				<div class="step--1 color--secondary">Choose a plan and fill in details</div>
				<div class="step--2 step--disabled">User &#38; Billing info</div>
			</div>

		</section>

	</div>
	
	<?php 
}
コード例 #19
0
/**
 * kool_preview_boxes shows the next set of posts. It shows as many boxes as
 * you show posts on your blog page. This works best when there is an even
 * number of posts displayed (2,4,6,8,10) but it can work with an odd number
 * if alignment is set or if the width of boxes is set to 100% which would allow
 * for a column effct.
 * 
 * To use kool_preview simply add the function call in your theme's index after
 * the content is displayed. I could technically go before as well.      
 */
function kool_preview_boxes()
{
    global $post;
    if (is_paged()) {
        $target_page = get_query_var('paged') + 1;
    } else {
        $target_page = 2;
    }
    $args = array('paged' => $target_page, 'orderby' => 'post_date', 'post_type' => 'post', 'post_status' => 'publish');
    $k_posts = new WP_Query($args);
    if ($k_posts and $k_posts->have_posts()) {
        while ($k_posts->have_posts()) {
            $k_posts->the_post();
            $thumb_query = array('numberposts' => 1, 'post_type' => 'attachment', 'post_parent' => $post->ID);
            echo '<div class="preview_box" >';
            $attachment = get_posts($thumb_query);
            foreach ($attachment as $attach) {
                if ($attach) {
                    $img = wp_get_attachment_image_src($attach->ID, $size = 'thumbnail', $icon = true);
                    echo "<img class='preview_thumb' src='{$img['0']}' >";
                }
            }
            echo '<a rel="bookmark" href=';
            the_permalink();
            echo '>';
            echo the_title() . '</a><br>';
            the_excerpt();
            echo "</div>";
        }
    }
}
コード例 #20
0
 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function ushipnetwork_entry_footer()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         $byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
         echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>' . '<div class="share">';
         include "share.php";
         echo '</div>' . '</div>';
         $posttags = get_the_tags();
         $count = 0;
         $separator = ', ';
         $output = '';
         if (!empty($posttags)) {
             echo '<span class="tag-list">tags: ';
             foreach ($posttags as $posttag) {
                 $count++;
                 if ($count <= 2) {
                     $output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator;
                 }
             }
             echo trim($output, $separator);
         }
         echo '</span>';
     }
     edit_post_link(sprintf(esc_html__('Edit %s', 'ushipnetwork'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
 }
コード例 #21
0
        function categori_news(){
            query_posts('cat=9&showposts=10&posts_per_page=3');

            while (have_posts()) : the_post();
                /*Dima insert*/the_excerpt(); ?>
                <div class="content-box">
                    <div class="bgr01"><div class="bgr02"><div class="bgr03">
                                <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; ">
                                    <div class="title">
                                        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                        <div class="date_all">
                                            <?php the_time('l, j ?F, Y') ?>
                                        </div>
                                        <div class="post">
                                            Написал <?php the_author_link() ?> <?php the_time('g:i A') ?>
                                        </div>
                                    </div>
                                    <div class="content_box">
                                        <?php the_content('Читать всё'); ?>
                                    </div>

                                    <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div>

                                    <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div>
                                    <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div>
                                </div>
                            </div></div></div>
                </div>
            <?php endwhile;}
コード例 #22
0
ファイル: vc_grid_item.php プロジェクト: Angelpm28/ong-canada
function vc_gitem_create_link_real($atts, $post, $default_class = '', $title = '')
{
    $link = '';
    $target = '';
    $title_attr = '';
    if (isset($atts['link'])) {
        $link_css_class = 'vc_gitem-link' . (strlen($default_class) > 0 ? ' ' . $default_class : '');
        if ('custom' === $atts['link'] && !empty($atts['url'])) {
            $link = vc_build_link($atts['url']);
            if (strlen($link['target'])) {
                $target = ' target="' . esc_attr($link['target']) . '"';
            }
            if (strlen($link['title'])) {
                $title = $link['title'];
            }
            $link = 'a href="' . esc_attr($link['url']) . '" class="' . esc_attr($link_css_class) . '"';
        } elseif ('post_link' === $atts['link']) {
            $link = 'a href="' . get_permalink($post->ID) . '" class="' . esc_attr($link_css_class) . '"';
            if (!strlen($title)) {
                $title = the_title('', '', false);
            }
        } elseif ('image' === $atts['link']) {
            $href_link = vc_gitem_template_attribute_post_image_url('', array('post' => $post, 'data' => ''));
            $link = 'a href="' . $href_link . '" class="' . esc_attr($link_css_class) . '"';
        } elseif ('image_lightbox' === $atts['link']) {
            $link = 'a' . vc_gitem_template_attribute_post_image_url_attr_prettyphoto('', array('post' => $post, 'data' => $link_css_class));
        }
    }
    if (strlen($title) > 0) {
        $title_attr = ' title="' . esc_attr($title) . '"';
    }
    return apply_filters('vc_gitem_post_data_get_link_real_link', $link, $atts, $post, $link_css_class) . apply_filters('vc_gitem_post_data_get_link_real_target', $target, $atts, $post) . apply_filters('vc_gitem_post_data_get_link_real_title', $title_attr, $atts);
}
コード例 #23
0
function stars_teams($gender, $season)
{
    $args = array('season' => $season, 'gender' => $gender, 'post_type' => 'team', 'posts_per_page' => -1);
    $teams = new WP_Query($args);
    ?>
        <h3><?php 
    echo ucfirst($gender) . ' ' . $season;
    ?>
 Teams</h3>
        <?php 
    if ($teams->have_posts()) {
        while ($teams->have_posts()) {
            $teams->the_post();
            ?>
            <p class="team-list-item"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></p>
        <?php 
        }
    }
    ?>
    <?php 
}
コード例 #24
0
function grid_archive_theme($post)
{
    ?>
<div class="archive-listing classic-grid">
		<a href="<?php 
    the_permalink();
    ?>
">
		<div style="background-image:url('<?php 
    if (wp_get_attachment_url(get_post_thumbnail_id($post->ID))) {
        $url = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    } else {
        $url = default_product_thumbnail_url();
    }
    echo $url;
    ?>
');" class="classic-grid-element"></div>
		<div class="product-name"><?php 
    the_title();
    ?>
</div>
		<?php 
    do_action('archive_price', $post);
    ?>
		</a>
</div>
<?php 
}
コード例 #25
0
    function widget($args, $instance)
    {
        extract($args);
        @($title = $instance['title'] ? $instance['title'] : '最热文章');
        @($num = $instance['num'] ? $instance['num'] : 5);
        echo $before_widget;
        ?>
      <div class="panel panel-zan hidden-xs">
        <div class="panel-heading"><?php 
        echo $title;
        ?>
</div>
        <div class="panel-body">
          <ul class="list-group">
            <?php 
        // 设置全局变量,实现post整体赋值
        global $post;
        $posts = zan_get_hotest_posts($num);
        foreach ($posts as $post) {
            setup_postdata($post);
            ?>
              <li class="zan-list clearfix">
                <figure class="thumbnail zan-thumb">
                  <?php 
            the_post_thumbnail(array(75, 75));
            ?>
                </figure>
                <a href="<?php 
            the_permalink();
            ?>
">
                 <h5><?php 
            the_title();
            ?>
</h5>
                </a>
                <div class="sidebar-info">
                  <span><i class="fa fa-calendar"></i> <?php 
            the_time('m月j日, Y');
            ?>
</span>
                  <span><i class="fa fa-comment"></i> <a href="<?php 
            the_permalink();
            ?>
#comments"><?php 
            comments_number('0', '1', '%');
            ?>
</a></span>
                </div>
              </li>
            <?php 
        }
        wp_reset_postdata();
        ?>
          </ul>
        </div>
      </div>
    <?php 
        echo $after_widget;
    }
コード例 #26
0
    function widget($args, $instance)
    {
        global $post;
        // Preserve global $post
        $preserve = $post;
        extract($args);
        // only useful on post pages
        if (!is_single()) {
            return;
        }
        $title = apply_filters('widget_title', empty($instance['title']) ? __('Read Next', 'largo') : $instance['title'], $instance, $this->id_base);
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        $related = new Largo_Related($instance['qty']);
        //get the related posts
        $rel_posts = new WP_Query(array('post__in' => $related->ids(), 'nopaging' => 1, 'posts_per_page' => $instance['qty'], 'ignore_sticky_posts' => 1));
        if ($rel_posts->have_posts()) {
            echo '<ul class="related">';
            while ($rel_posts->have_posts()) {
                $rel_posts->the_post();
                echo '<li>';
                echo '<a href="' . get_permalink() . '"/>' . get_the_post_thumbnail(get_the_ID(), 'thumbnail', array('class' => 'alignleft')) . '</a>';
                ?>
				<h4><a href="<?php 
                the_permalink();
                ?>
" title="Read: <?php 
                esc_attr(the_title('', '', FALSE));
                ?>
"><?php 
                the_title();
                ?>
</a></h4>
				<h5 class="byline">
					<span class="by-author"><?php 
                largo_byline(true, true);
                ?>
</span>
					<time class="entry-date updated dtstamp pubdate" datetime="<?php 
                echo esc_attr(get_the_date('c'));
                ?>
"><?php 
                largo_time();
                ?>
</time>
				</h5>
				<?php 
                // post excerpt/summary
                largo_excerpt(get_the_ID(), 2, false, '', true);
                echo '</li>';
            }
            echo "</ul>";
        }
        echo $after_widget;
        // Restore global $post
        wp_reset_postdata();
        $post = $preserve;
    }
コード例 #27
0
ファイル: woo-tabs.php プロジェクト: shramee/test-ppb
    function woo_widget_tabs_latest($posts = 5, $size = 45)
    {
        global $post;
        $latest = get_posts(array('suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'post_date', 'order' => 'desc', 'numberposts' => $posts));
        foreach ($latest as $post) {
            setup_postdata($post);
            ?>
			<li>
				<?php 
            if ($size != 0) {
                woo_image('height=' . $size . '&width=' . $size . '&class=thumbnail&single=true');
            }
            ?>
				<a title="<?php 
            the_title_attribute();
            ?>
" href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a>
				<span class="meta"><?php 
            the_time(get_option('date_format'));
            ?>
</span>
				<div class="fix"></div>
			</li>
		<?php 
        }
        wp_reset_postdata();
    }
コード例 #28
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $number = $instance['number'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
		<div class="recent-works-items clearfix">
		<?php 
        $args = array('post_type' => 'evolve_portfolio', 'posts_per_page' => $number, 'has_password' => false);
        $portfolio = new WP_Query($args);
        if ($portfolio->have_posts()) {
            ?>
		<?php 
            while ($portfolio->have_posts()) {
                $portfolio->the_post();
                ?>
		<?php 
                if (has_post_thumbnail()) {
                    ?>
		<?php 
                    $link_target = "";
                    $url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                    if (!empty($url_check)) {
                        $new_permalink = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true);
                        if (get_post_meta(get_the_ID(), 'pyre_link_icon_target', true) == "yes") {
                            $link_target = ' target="_blank"';
                        }
                    } else {
                        $new_permalink = get_permalink();
                    }
                    ?>
		<a href="<?php 
                    echo $new_permalink;
                    ?>
"<?php 
                    echo $link_target;
                    ?>
 title="<?php 
                    the_title();
                    ?>
">
			<?php 
                    the_post_thumbnail('recent-works-thumbnail');
                    ?>
		</a>
		<?php 
                }
            }
        }
        wp_reset_query();
        ?>
		</div>

		<?php 
        echo $after_widget;
    }
コード例 #29
-1
 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function xmaps_entry_footer()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'xmaps'));
         if ($categories_list && xmaps_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html__('Posted in %1$s', 'xmaps') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'xmaps'));
         if ($tags_list) {
             printf('<span class="tags-links">' . esc_html__('Tagged %1$s', 'xmaps') . '</span>', $tags_list);
             // WPCS: XSS OK.
         }
     }
     if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
         echo '<span class="comments-link">';
         /* translators: %s: post title */
         comments_popup_link(sprintf(wp_kses(__('Leave a Comment<span class="screen-reader-text"> on %s</span>', 'xmaps'), array('span' => array('class' => array()))), get_the_title()));
         echo '</span>';
     }
     edit_post_link(sprintf(esc_html__('Edit %s', 'xmaps'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
 }
コード例 #30
-9
/**
 * Add breadcrumbs functionality to your WordPress theme
 *
 * Once you have included the function in your functions.php file
 * you can then place the following anywhere in your theme templates
 * if(function_exists('bootstrap_breadcrumbs')) bootstrap_breadcrumbs();
 *
 * credit to: c.bavota - http://bavotasan.com (thanks for the code start)
 */
function bootstrap_breadcrumbs()
{
    echo '<ol class="breadcrumb">';
    echo '<li><a href="' . home_url('/') . '">Home</a></li>';
    // are we at "blog home"?
    if (is_home()) {
        echo '<li><a href="#">Blogs</a></li>';
    }
    // where else do we want breadcrumbs
    if (!is_page_template('pt-home.php') && !is_home()) {
        // check if we're in a commerce plugin
        if (function_exists('is_woocommerce') && is_woocommerce()) {
            echo '<li><a href="/publications/order/">Shop</a></li>';
            $product_cats = wp_get_post_terms(get_the_ID(), 'product_cat');
            echo '<li><a href="/publications/order/' . str_replace(" ", "-", $product_cats[0]->name) . '">' . $product_cats[0]->name . '</a></li>';
        }
        // breadcrumb wordpress structures
        if (is_category() || is_single() || is_single('aof')) {
            if (get_the_category()) {
                $category = get_the_category();
                echo '<li><a href="/blog/category/' . str_replace(" ", "-", $category[0]->cat_name) . '">' . $category[0]->cat_name . '</a></li>';
            }
            if (is_single()) {
                echo '<li class="active">';
                the_title();
                echo '</li>';
            }
        } elseif (is_page()) {
            echo '<li class="active">';
            the_title();
            echo '</li>';
        }
    }
    echo '</ol>';
}