Example #1
0
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? 'From The Blog' : $instance['title']);
        $posts_number = empty($instance['posts_number']) ? '' : $instance['posts_number'];
        $blog_category = empty($instance['blog_category']) ? '' : $instance['blog_category'];
        echo $before_widget;
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        ?>
	
	<ul>
		<?php 
        query_posts("showposts=" . $posts_number . "&cat=" . $blog_category);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
			<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li>
		<?php 
            }
        }
        wp_reset_query();
        ?>
	</ul> <!-- end ul.nav -->
<?php 
        echo $after_widget;
    }
    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;
        }
        echo '<ul>';
        query_posts(array('post_type' => 'portfolio', 'showposts' => $number));
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>
				
				<li>
					<a href="<?php 
                the_permalink();
                ?>
">
						<?php 
                the_post_thumbnail('portfolio');
                ?>
					</a>
				</li>
				
				<?php 
            }
        }
        wp_reset_query();
        echo '</ul>';
        echo $after_widget;
    }
Example #3
0
 function st_vc_blog($attr, $content = false)
 {
     $data = shortcode_atts(array('st_blog_number_post' => 5, 'st_blog_orderby' => 0, 'st_blog_order' => '', 'st_blog_style' => '', 'st_category' => '', 'st_style' => 'style1'), $attr, 'st_blog');
     extract($data);
     $query = array('post_type' => 'post', 'orderby' => $st_blog_orderby, 'order' => $st_blog_order, 'posts_per_page' => $st_blog_number_post);
     if ($st_category != '0' && $st_category != '') {
         $query['tax_query'][] = array('taxonomy' => 'category', 'terms' => explode(',', $st_category));
     }
     query_posts($query);
     $txt = '';
     while (have_posts()) {
         the_post();
         if ($st_style == 'style1') {
             $txt .= st()->load_template('vc-elements/st-blog/loop', false, $data);
         }
         if ($st_style == 'style2') {
             $txt .= st()->load_template('vc-elements/st-blog/loop2', false, $data);
         }
     }
     wp_reset_query();
     $r = '<div class="row row-wrap">
              ' . $txt . '
            </div>';
     return $r;
 }
 function test_redirection_with_asperand()
 {
     $post_id = $this->factory->post->create(array('post_type' => 'post'));
     $this->assertTrue($this->plugin()->set_link($post_id, 'http://example.com/@test'));
     query_posts(array('p' => $post_id));
     $this->assertEquals('http://example.com/%40test', $this->plugin()->get_redirect());
 }
function get_child_pages()
{
    global $post;
    rewind_posts();
    //stops any previous loops
    query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order'));
    //query and order child pages
    while (have_posts()) {
        the_post();
        $childPermalink = get_permalink($post->ID);
        //post permalink
        $childID = $post->ID;
        //post it
        $childTitle = $post->post_title;
        //post title
        $childExcerpt = $post->post_excerpt;
        //post excerpt
        $childImage = get_the_post_thumbnail($page->ID, 'featured-spotlight');
        //post thumbnail
        echo '<div class="tile">';
        echo '<div class="tile-image">' . $childImage . '</div>';
        echo '<h1 id="cta-h1"><a href="' . $childPermalink . '">' . $childTitle . '</a></h1>';
        echo '<p class="caption"><a href="' . $childPermalink . '"><span>' . $childExcerpt . '</span></a></p>';
        echo '</div>';
    }
    wp_reset_query();
    // reset query
}
Example #6
0
    function widget($args, $instance)
    {
        global $post, $wp_query;
        Protect();
        extract($args, EXTR_SKIP);
        $post_query = 'showposts=1&cat=' . $instance['thecat'];
        $posts =& query_posts($post_query);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                echo $before_widget;
                $title = empty($instance['title']) ? 'Latest Excerpt' : apply_filters('widget_title', $instance['title']);
                if (!empty($title)) {
                    echo $before_title . $title . $after_title;
                }
                ?>
				<ul>
					<li><a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></li>
					<li><?php 
                the_excerpt();
                ?>
</li>
				</ul>
				<?php 
                echo $after_widget;
            }
        }
        UnProtect();
    }
Example #7
0
function get_child_pages()
{
    global $post;
    rewind_posts();
    // stop any previous loops
    query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order'));
    // query and order child pages
    while (have_posts()) {
        the_post();
        $childPermalink = get_permalink($post->ID);
        // post permalink
        $childID = $post->ID;
        // post id
        $childTitle = $post->post_title;
        // post title
        $childExcerpt = $post->post_excerpt;
        // post excerpt
        echo '<article id="page-excerpt-' . $childID . '" class="page-excerpt">';
        echo '<h3><a href="' . $childPermalink . '">' . $childTitle . ' &raquo;</a></h3>';
        echo '<p>' . $childExcerpt . ' <a href="' . $childPermalink . '">Read More&nbsp;&raquo;</a></p>';
        echo '</article>';
    }
    // reset query
    wp_reset_query();
}
Example #8
0
 function get($queryArgs = null)
 {
     $defaults = array('post_type' => $this->name);
     $paged = intval(get_query_var('paged'));
     if ($paged) {
         $defaults['paged'] = $paged;
     }
     if (isset($_GET[$this->name])) {
         $defaults['name'] = sanitize_title($_GET[$this->name]);
     } else {
         $pagename = get_query_var('pagename');
         if (!empty($pagename)) {
             $defaults['name'] = sanitize_title($pagename);
         }
     }
     $queryArgs = wp_parse_args($queryArgs, $defaults);
     $posts = query_posts($queryArgs);
     if (isset($queryArgs['name'])) {
         $GLOBALS['wp_query']->is_single = true;
     }
     // remove the 404 from the main wp_query object
     if (is_single() && !empty($post)) {
         $GLOBALS['wp_query']->is_404 = false;
     }
     return $this->Query;
 }
function get_project_count()
{
    $showposts = -1;
    $args = array('post_type' => 'projects', 'author' => $user_ID, 'orderby' => 'post_title', 'order' => 'ASC', 'post_status' => array('publish'), 'posts_per_page' => $showposts);
    $count = count(query_posts($args));
    return $count;
}
Example #10
0
function writeShoppingCart()
{
    global $wpdb;
    $settings = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "photocrati_ecommerce_settings WHERE id = 1", ARRAY_A);
    foreach ($settings as $key => $value) {
        ${$key} = $value;
    }
    $cart = $_SESSION['cart'];
    if (!$cart) {
        return '<p><em>' . $ecomm_empty . '</em> </p>';
    } else {
        // Parse the cart session variable
        $items = explode(',', $cart);
        $s = count($items) > 1 ? 's' : '';
        if (get_option('permalink_structure') != '') {
            return '<button id="addto2" class="positive" style="margin:0 5px;" onClick=\'window.location.href = "' . get_bloginfo('url') . '/' . str_replace(" ", "-", strtolower($ecomm_title)) . '/"\'><img src="' . photocrati_gallery_file_uri('image/cart.png') . '"> ' . $ecomm_title . ': ' . count($items) . ' item' . $s . '</button>';
        } else {
            $pgid = query_posts(array('pagename' => $ecomm_title));
            foreach ($pgid as $pgid) {
                $pageid = $pgid->ID;
            }
            wp_reset_query();
            return '<button id="addto2" class="positive" style="margin:0 5px;" onClick=\'window.location.href = "' . get_bloginfo('url') . '/?page_id=' . $pageid . '"\'><img src="' . photocrati_gallery_file_uri('image/cart.png') . '"> ' . $ecomm_title . ': ' . count($items) . ' item' . $s . '</button>';
        }
    }
}
function ajax_navigation_callback()
{
    global $wp_query, $page_no, $loop, $query;
    // this is how you get access to the database
    $loop = empty($_POST['loop']) ? 'loop' : $_POST['loop'];
    $posts_per_page = get_option('posts_per_page');
    //merge the query array and paged
    $query = $_POST;
    unset($query['action']);
    unset($query['loop']);
    ob_start();
    # Load the posts
    if ($loop) {
        query_posts($query);
        while (have_posts()) {
            the_post();
            get_template_part($loop);
        }
    }
    $buffer = ob_get_contents();
    ob_end_clean();
    echo $buffer;
    exit;
    // this is required to return a proper result
}
Example #12
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;}
Example #13
0
function show_category($cid = 1)
{
    $args = array('showposts' => 4, 'cat' => $cid, 'orderby' => 'post_date', 'order' => 'desc');
    query_posts($args);
    global $the_post;
    $category = '';
    while (have_posts()) {
        the_post();
        $cat = get_the_category(get_the_ID());
        $link = get_permalink(get_the_ID());
        $src = get_the_post_thumbnail(get_the_ID(), 'index_thumb');
        $c_name = $cat[0]->name;
        $title = get_the_title();
        echo $category .= <<<EOF
        <div class="box">
          <a href="{$link}">
          <div class="boximg">{$src}</div>
          <div class="category">{$c_name}</div>
          <p>{$title}</p>
          </a>
        </div>
EOF;
    }
    wp_reset_query();
    return $category;
}
Example #14
0
function jigoshop_product_tag($attributes)
{
    global $paged;
    $jigoshop_options = Jigoshop_Base::get_options();
    $attributes = shortcode_atts(array('tag' => '', 'per_page' => $jigoshop_options->get('jigoshop_catalog_per_page'), 'columns' => $jigoshop_options->get('jigoshop_catalog_columns'), 'orderby' => $jigoshop_options->get('jigoshop_catalog_sort_orderby'), 'order' => $jigoshop_options->get('jigoshop_catalog_sort_direction'), 'pagination' => false, 'tax_operator' => 'IN'), $attributes);
    if (isset($_REQUEST['tag'])) {
        $attributes['tag'] = $_REQUEST['tag'];
    }
    /** Operator validation. */
    if (!in_array($attributes['tax_operator'], array('IN', 'NOT IN', 'AND'))) {
        $tax_operator = 'IN';
    }
    /** Multiple category values. */
    if (!empty($slug)) {
        $slug = explode(',', esc_attr($slug));
        $slug = array_map('trim', $slug);
    }
    $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $attributes['per_page'], 'orderby' => $attributes['orderby'], 'order' => $attributes['order'], 'paged' => $paged, 'meta_query' => array(array('key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN')), 'tax_query' => array(array('taxonomy' => 'product_tag', 'field' => 'slug', 'terms' => $attributes['tag'], 'operator' => $attributes['tax_operator'])));
    query_posts($args);
    ob_start();
    jigoshop_get_template_part('loop', 'shop');
    if ($attributes['pagination']) {
        do_action('jigoshop_pagination');
    }
    wp_reset_query();
    return ob_get_clean();
}
 /**
  * Find all of the required posts
  *
  * @param  array $content
  * @return array
  */
 public static function get_posts($content)
 {
     // Set up date filter
     self::date_range($content['from_date'], $content['to_date']);
     // Query parameters
     $params = array('post_status' => 'future, publish', 'cat' => implode(',', $content['categories']), 'orderby' => 'date', 'order' => 'desc', 'posts_per_page' => $content['posts_number'] === 'All' ? self::$result_limit[$content['layout']] : 1);
     // Get Posts
     $query_results = query_posts($params);
     // Remove filters and parameters to stop it from messing with our queries
     wp_reset_query();
     remove_filter('posts_where', array('Posts_Widget', 'date_filter'));
     // Get custom fields for each post and filter
     $results = array();
     if (isset($content['filter_by']) && $content['filter_by'] === 'category') {
         foreach ($query_results as $result) {
             // Gets the posts categories
             foreach (get_the_category($result->ID) as $cat) {
                 $result->fields = (object) get_fields($result->ID);
                 $results[$cat->cat_name][] = $result;
             }
         }
     } else {
         foreach ($query_results as $result) {
             $year = mysql2date("Y", $result->post_date_gmt);
             $result->fields = (object) get_fields($result->ID);
             $results[$year][] = $result;
         }
     }
     return $results;
 }
Example #16
0
 public function get_post_count($post_type = 'item')
 {
     $author_args = array('post_status' => 'publish', 'post_type' => $post_type, 'author' => $this->author->ID);
     $author_posts = query_posts($author_args);
     wp_reset_query();
     return count($author_posts);
 }
Example #17
0
    function featured_index()
    {
        $output = '';
        $args = array('tag' => 'featured', 'posts_per_page' => 3);
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $the_img = $this->get_img_src(get_the_ID());
                if ($the_img == 'zero') {
                }
                $output .= '<div class=" mdl-cell mdl-cell--4-col mdl-card mdl-shadow--2dp">';
                $output .= ' <div class="mdl-card__title mdl-card--expand" style="background-image: url( \' ' . $the_img . '  \' )">
							  </div>
							  <div class="mdl-card__supporting-text">
								' . get_the_title() . '
							  </div>
							  <div class="mdl-card__actions mdl-card--border">
								<a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">
								  View Updates
								</a>
							  </div>';
                $output .= '</div>';
            }
        } else {
            $output = 'gagal';
        }
        wp_reset_query();
        return $output;
    }
    public static function friend_list_func($atts, $content = "")
    {
        $atts = shortcode_atts(array('per_page' => '100'), $atts, 'friend_list');
        $return = "";
        query_posts(array('post_type' => 'friend', 'showposts' => $atts['per_page'], 'meta_query' => array('relation' => 'AND', array('key' => 'avatar150', 'value' => 'https://static0.fitbit.com/images/profile/defaultProfile_100_male.gif', 'compare' => 'NOT LIKE'), array('key' => 'avatar150', 'value' => 'https://static0.fitbit.com/images/profile/defaultProfile_100_female.gif', 'compare' => 'NOT LIKE'))));
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $displayName = get_post_meta(get_the_id(), 'displayName', true);
                $avatar = get_post_meta(get_the_id(), 'avatar150', true);
                $return .= sprintf('<div class="col-lg-3 col-sm-3 focus-box">
		 								<div class="service-icon">
		 									<i style="background:url(%s) no-repeat center;width:100%%; height:100%%;" class="pixeden"></i>
		 								</div>
		 								<h3 class="red-border-bottom">%s</h3>
		 								<a class="btn btn-primary btn-block green-btn btn-sm" href="https://www.fitbit.com/user/%s"><i class="fa fa-plus"></i> Add Friend</a>
		 								<br/>
		 							</div>', $avatar, $displayName, get_the_title(), get_the_content());
            }
            $return = '<div class="hwd-wrapper"><div class="row">' . $return . '</div></div>';
        } else {
            $return = 'No Friends Found';
        }
        wp_reset_query();
        return $return;
    }
 function van_check_menu()
 {
     global $VAN;
     //If custom menu exist,get the ID of pages
     if (($locations = get_nav_menu_locations()) && $locations['primary_navi']) {
         $menu = wp_get_nav_menu_object($locations['primary_navi']);
         $menu_items = wp_get_nav_menu_items($menu->term_id);
         $pageID = array();
         foreach ($menu_items as $item) {
             if ($item->object == 'page') {
                 $pageID[] = $item->object_id;
             }
         }
         query_posts(array('post_type' => 'page', 'post__in' => $pageID, 'posts_per_page' => count($pageID), 'orderby' => 'post__in'));
     } else {
         //If custom menu doesn't exist,check default page menu setting in theme options
         //If default page menu setting exist
         if (isset($VAN['pages_navi']) && $VAN['pages_navi'] != '') {
             query_posts(array('post_type' => 'page', 'post__in' => $VAN['pages_navi'], 'posts_per_page' => count($VAN['pages_navi']), 'orderby' => 'menu_order', 'order' => 'ASC'));
         } else {
             //If default page menu setting doesn't exist
             query_posts(array('post_type' => 'page', 'posts_per_page' => 6, 'orderby' => 'menu_order', 'order' => 'ASC'));
         }
     }
 }
 function widget($args, $instance)
 {
     if (!is_home()) {
         return false;
     }
     /*
         Query the first post:
          If it has a featured image, display it,
          and store its ID in an array.
     */
     query_posts('posts_per_page=1');
     while (have_posts()) {
         the_post();
         $do_not_duplicate[] = $post->ID;
         get_template_part('feature', 'index');
     }
     /*
         Excerpt post loop.
          If a #feature post exists, do not duplicate.
     */
     if ((int) $instance['excerpts_count'] > 0) {
         query_posts(array('post__not_in' => $do_not_duplicate, 'offset' => 1, 'posts_per_page' => (int) $instance['excerpts_count']));
         echo '<div class="clearfix">';
         for ($post_count = 1; have_posts(); $post_count++) {
             the_post();
             $do_not_duplicate[] = $post->ID;
             /*
                 See: lib/helpers.php -> sourdough_excerpt()
             */
             sourdough_excerpt($post_count);
         }
         echo '</div>';
     }
     wp_reset_query();
 }
 /**
  * the actual post query
  */
 public static function query()
 {
     $format = get_query_var('format_filter');
     if ($format) {
         global $wpv_post_formats;
         $post_formats_longname = array();
         $query = array('tax_query' => array(array('taxonomy' => 'post_format', 'field' => 'slug')), 'paged' => get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1), 'format_filter' => $format);
         if ($format == 'standard') {
             foreach ($wpv_post_formats as $f) {
                 $post_formats_longname[] = 'post-format-' . $f;
             }
             $query['tax_query'][0]['terms'] = $post_formats_longname;
             $query['tax_query'][0]['operator'] = 'NOT IN';
         } else {
             $query['tax_query'][0]['terms'] = array('post-format-' . $format);
             $query['tax_query'][0]['operator'] = 'IN';
         }
         query_posts($query);
         unset($GLOBALS['wp_the_query']);
         $GLOBALS['wp_the_query'] =& $GLOBALS['wp_query'];
         if (count($GLOBALS['wp_query']->posts) == 0) {
             $GLOBALS['wp_query']->set_404();
             header('HTTP/1.0 404 Not Found');
         }
     }
     return;
 }
function efs_get_slider()
{
    /**Options Array...to be added on admin later...*/
    $showTitle = true;
    $showText = true;
    $beforeTitle = "<strong>";
    $afterTitle = "</strong>";
    $slider = '<div class="flexslider contain">
	  <ul class="slides">';
    $efs_query = "post_type=slider-image";
    query_posts($efs_query);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            $img = get_the_post_thumbnail($post->ID, 'large');
            $slider .= '<li>' . $img;
            if ($showTitle || $showText) {
                $slider .= '<p class="flex-caption">';
                $slider .= $showTitle ? $beforeTitle . get_the_title() . $afterTitle : '';
                $slider .= $showText ? '<br/>' . get_the_content() : '';
                $slider .= '</p>';
            }
            $slider .= '</li>';
        }
    }
    wp_reset_query();
    $slider .= '</ul>
	</div>';
    return $slider;
}
/**
 * Retrieve a download by a given field
 *
 * @since       2.0
 * @param       string $field The field to retrieve the discount with
 * @param       mixed $value The value for field
 * @return      mixed
 */
function edd_get_download_by($field = '', $value = '')
{
    if (empty($field) || empty($value)) {
        return false;
    }
    switch (strtolower($field)) {
        case 'id':
            $download = get_post($value);
            if (get_post_type($download) != 'download') {
                return false;
            }
            break;
        case 'slug':
        case 'name':
            $download = query_posts(array('post_type' => 'download', 'name' => sanitize_title_for_query($value), 'posts_per_page' => 1, 'post_status' => 'any'));
            if ($download) {
                $download = $download[0];
            }
            break;
        case 'sku':
            $download = query_posts(array('post_type' => 'download', 'meta_key' => 'edd_sku', 'meta_value' => $value, 'posts_per_page' => 1, 'post_status' => 'any'));
            if ($download) {
                $download = $download[0];
            }
            break;
        default:
            return false;
    }
    if ($download) {
        return $download;
    }
    return false;
}
 function get_results($count = false)
 {
     global $wpdb;
     $offset = ($this->page_num - 1) * $this->per_page;
     if ($this->search_term !== '') {
         if (is_array($this->post_status)) {
             $this->post_status = $this->post_status[0];
         }
         if ($this->post_status !== 'any') {
             $post_status_query = "AND {$wpdb->posts}.post_status = '" . $this->post_status . "' ";
         } else {
             $post_status_query = '';
         }
         $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} " . "WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id " . $post_status_query . "AND {$wpdb->posts}.post_type = %s " . "AND ({$wpdb->posts}.post_title LIKE %s " . "OR ({$wpdb->postmeta}.meta_value LIKE %s)) " . "GROUP BY {$wpdb->posts}.post_title " . "ORDER BY {$wpdb->posts}.post_date " . "DESC LIMIT %d " . "OFFSET %d", $this->post_type, '%' . $this->search_term . '%', '%' . $this->search_term . '%', $this->per_page, $offset), OBJECT);
         if ($count) {
             return count($results);
         } else {
             return $results;
         }
     } else {
         if ($this->period !== '') {
             add_filter('posts_where', array(&$this, 'filter_where'));
         }
         return query_posts($this->args);
         remove_filter('posts_where', array(&$this, 'filter_where'));
     }
 }
Example #25
0
function get_child_pages()
{
    global $post;
    rewind_posts();
    // stop any previous loops
    query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order'));
    // query and order child pages
    while (have_posts()) {
        the_post();
        $childPermalink = get_permalink($post->ID);
        // post permalink
        $childID = $post->ID;
        // post id
        $childTitle = $post->post_title;
        // post title
        $childExcerpt = $post->post_excerpt;
        // post excerpt
        echo '<article id="page-excerpt-' . $childID . '" class="box-left">';
        echo '<div class="section-box">';
        echo '<p id="button"><a href="' . $childPermalink . '">' . $childTitle . '</a></p>';
        echo '</div>';
        echo '<div class="section-boxes">';
        echo '<p id>' . $childExcerpt . ' <a href="' . $childPermalink . '">';
        ?>
 <i class="fa fa-arrow-circle-right"></i> <?php 
        '</a></p>';
        echo '</div>';
        echo '</article>';
    }
    // reset query
    wp_reset_query();
}
Example #26
0
/**
 * Render all the ajax comments
 */
function siteorigin_ajax_comments_ajax_comment_rerender($location, $comment)
{
    if (empty($_POST['is_ajax'])) {
        return $location;
    }
    $post_id = isset($_POST['comment_post_ID']) ? intval($_POST['comment_post_ID']) : '';
    // We're going to pretend this is a single
    $query = array('post_id' => $post_id);
    if (get_option('page_comments')) {
        $args['per_page'] = get_option('comments_per_page');
        $cpage = get_page_of_comment($comment->comment_ID, $args);
        $query['cpage'] = $cpage;
    }
    // Prevents a conflict with older versions of Page Builder.
    remove_filter('the_posts', 'siteorigin_panels_prepare_post_content');
    query_posts($query);
    global $wp_query;
    $wp_query->is_single = true;
    $wp_query->is_singular = true;
    ob_start();
    comments_template();
    $comment_html = ob_get_clean();
    wp_reset_query();
    echo json_encode(array('status' => 'success', 'html' => $comment_html));
    exit;
}
 function postHighlights()
 {
     $pluginFolder = plugin_basename(dirname(__FILE__));
     load_plugin_textdomain('ph', "wp-content/plugins/{$pluginFolder}/languages", "{$pluginFolder}/languages");
     $this->basepath = WP_CONTENT_DIR . "/plugins/{$pluginFolder}/";
     $this->baseurl = WP_CONTENT_URL . "/plugins/{$pluginFolder}/";
     $this->optionsPrefix = 'post_highlights_';
     $this->custom_thumb_name = 'posthighlightscustomthumb';
     $this->checkForOldSettings();
     $this->loadTheme();
     register_deactivation_hook(__FILE__, array(&$this, 'ph_deactivate'));
     if (current_user_can('manage-post-highlights')) {
         add_action('admin_print_scripts-edit.php', array(&$this, 'addJS'));
         add_action('admin_print_styles-edit.php', array(&$this, 'addCSS'));
         add_action('admin_print_scripts-edit-pages.php', array(&$this, 'addJS'));
         add_action('admin_print_styles-edit-pages.php', array(&$this, 'addCSS'));
         add_action('manage_posts_custom_column', array(&$this, 'highlight_It'), 10, 2);
         add_filter('manage_posts_columns', array(&$this, 'add_column'));
         add_action('manage_pages_custom_column', array(&$this, 'highlight_It'), 10, 2);
         add_filter('manage_pages_columns', array(&$this, 'add_column'));
         add_action('restrict_manage_posts', array(&$this, 'posts_filter'));
         add_action('admin_print_scripts-toplevel_page_post-highlights', array(&$this, 'addJS'));
         add_action('admin_print_styles-toplevel_page_post-highlights', array(&$this, 'addCSS'));
         global $pagenow;
         if ($pagenow == 'edit.php' && isset($_GET['showhighlighted'])) {
             query_posts('meta_key=ph_order&orderby=meta_value&order=ASC&m=' . $_GET['m'] . '&cat=' . $_GET['cat'] . '&paged=' . $_GET['paged']);
         }
     }
     add_action('admin_menu', array(&$this, 'add_options_page'));
     add_action('admin_init', array(&$this, 'global_settings'));
     if ($this->get_option('custom_thumb')) {
         add_filter('intermediate_image_sizes', array(&$this, 'register_custom_thumb'));
     }
 }
function zp_custom_blog_page()
{
    global $post, $paged;
    $include = genesis_get_option('blog_cat');
    $exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : '';
    if (get_query_var('paged')) {
        $paged = get_query_var('paged');
    } elseif (get_query_var('page')) {
        $paged = get_query_var('page');
    } else {
        $paged = 1;
    }
    //* Arguments
    $args = array('cat' => $include, 'category__not_in' => $exclude, 'posts_per_page' => genesis_get_option('blog_cat_num'), 'paged' => $paged);
    query_posts($args);
    if (have_posts()) {
        while (have_posts()) {
            the_post();
            do_action('genesis_before_entry');
            printf('<article %s>', genesis_attr('entry'));
            // check post format and call template
            $format = get_post_format();
            get_template_part('content', $format);
            do_action('genesis_after_entry_content');
            //do_action( 'genesis_entry_footer' );
            echo '</article>';
            do_action('genesis_after_entry');
        }
    }
    //* Genesis navigation
    genesis_posts_nav();
    //* Restore original query
    wp_reset_query();
}
Example #29
0
function add_shortcode_blog($atts)
{
    extract(shortcode_atts(array('categories' => '', 'count' => 4), $atts));
    $output = '';
    $output .= '<div class="blog-post-shortcode">';
    $i = 0;
    $args = array("post_type" => "post", "posts_per_page" => $count, "cat" => $categories);
    query_posts($args);
    while (have_posts()) {
        the_post();
        $output .= '<div class="post-home three columns">';
        $output .= '<div class="post-format-wrap">';
        $output .= tf_get_post_format(array('image' => array('width' => 420, 'height' => 290), 'gallery' => array('width' => 420, 'height' => 290), 'video' => array('width' => 420, 'height' => 290)));
        $output .= '</div>';
        $output .= '<h4><a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>';
        $output .= '<div>' . get_the_date('d M, Y') . ' &nbsp;-&nbsp; ' . get_comments_number() . ' ' . __('comments', THEME_SLUG) . '</div>';
        $output .= '<p>' . tf_the_excerpt_max_charlength(120) . '</p>';
        $output .= '</div>';
    }
    wp_reset_query();
    wp_reset_postdata();
    $output .= '</div>';
    $output .= '<div class="clear"></div>';
    return $output;
}
function rmcc_report_listing_shortcode1($atts)
{
    global $wp_query, $cur_post_id;
    ob_start();
    $args = array('post_type' => 'wp_research', 'posts_per_page' => 3, 'order' => 'DESC', 'orderby' => 'post_date', 'post__not_in' => array($cur_post_id));
    query_posts($args);
    if (have_posts()) {
        ?>
        <ul>
        	<li style="color:#d51067">Other CFE reports: </li>
        	<?php 
        while (have_posts()) {
            the_post();
            ?>
				<li class="menu-item-type-wp_research"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></li>            
			<?php 
        }
        wp_reset_query();
        ?>
        </ul>
    <?php 
        $myvariable = ob_get_clean();
        return $myvariable;
    }
}