/** * Display the post content with a link to the single post * @since 1.0.0 */ function actions_post_content() { if (is_search()) { ?> <header class="page-header"> <h1 class="page-title"><?php printf(__('Search Results for: %s', 'actions'), '<span>' . esc_html(get_search_query()) . '</span>'); ?> </h1> </header><!-- .page-header --> <?php } while (have_posts()) { the_post(); ?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php actions_post_header(); ?> <div class="entry-content"> <?php actions_post_thumbnail('full'); if ('post' == get_post_type()) { ?> <div class="entry-meta"> <?php actions_posted_on(); ?> </div> <?php } if (is_search()) { the_excerpt(); } else { the_content(sprintf(__('Continue reading %s', 'actions'), '<span class="screen-reader-text">' . esc_url(get_the_title()) . '</span>')); } wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'actions'), 'after' => '</div>')); //actions_entry_footer(); ?> </div><!-- .entry-content --> </article><!-- #post-## --> <?php } }
function Page() { ?> <div class="article"> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php Page_Header(); ?> <?php Article_Content(); ?> <?php Page_Footer(); ?> </article> </div> <?php }
/** * Outputs the content for a new widget instance. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ function widget($args, $instance) { extract($args); if (isset($instance['page']) && $instance['page'] != -1) { $page_id = (int) $instance['page']; $p = new WP_Query(array('page_id' => $page_id)); if ($p->have_posts()) { $p->the_post(); $title = apply_filters('widget_title', empty($instance['title']) ? get_the_title() : $instance['title'], $instance, $this->id_base); echo $before_widget; echo $before_title; echo $title; echo $after_title; ?> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php the_content(); ?> </div> <?php echo $after_widget; wp_reset_postdata(); } } }
function Article() { ?> <div class="article"> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php Article_Header(); ?> <?php if (is_single()) { Article_Content(); } else { Article_Continue(); } ?> <?php Article_Footer(); ?> </article> </div> <?php }
function Search() { ?> <div class="article"> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php Search_Header(); ?> <?php Article_Summary(); ?> <?php Article_Footer(); ?> </article> </div> <?php }
public function getPosts($get, $post) { if (!isset($get['form_id'])) { echo ''; die; } $form_id = intval($get['form_id']); $fm = CRED_Loader::get('MODEL/Forms'); $form_settings = $fm->getFormCustomField($form_id, 'form_settings'); if (!$form_settings) { echo ''; die; } //print_r($form_settings); $post_type = $form_settings['post_type']; $post_query = new WP_Query(array('post_type' => $post_type, 'posts_per_page' => -1)); ob_start(); if ($post_query->have_posts()) { while ($post_query->have_posts()) { $post_query->the_post(); ?> <option value="<?php the_ID(); ?> "><?php the_title(); ?> </option> <?php } } $output = ob_get_clean(); echo $output; die; }
/** @see WP_Widget::widget */ function widget($args, $instance) { $cache = wp_cache_get('widget_recent_products', 'widget'); if ( !is_array($cache) ) $cache = array(); if ( isset($cache[$args['widget_id']]) ) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base); if ( !$number = (int) $instance['number'] ) $number = 10; else if ( $number < 1 ) $number = 1; else if ( $number > 15 ) $number = 15; $show_variations = $instance['show_variations'] ? '1' : '0'; $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product'); if($show_variations=='0'){ $args['meta_query'] = array( array( 'key' => 'visibility', 'value' => array('catalog', 'visible'), 'compare' => 'IN' ) ); $args['parent'] = '0'; } $r = new WP_Query($args); if ($r->have_posts()) : ?> <?php echo $before_widget; ?> <?php if ( $title ) echo $before_title . $title . $after_title; ?> <ul class="product_list_widget"> <?php while ($r->have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?> <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"> <?php if (has_post_thumbnail()) the_post_thumbnail('shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?> <?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a> <?php echo $_product->get_price_html(); ?></li> <?php endwhile; ?> </ul> <?php echo $after_widget; ?> <?php // Reset the global $the_post as this query will have stomped on it //wp_reset_postdata(); endif; if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_recent_products', $cache, 'widget'); }
function section_template() { $loop = new fotosPostLoop(); $artsep = pl_setting('ba_fotos_art_sep'); if (have_posts()) { while (have_posts()) { the_post(); ?> <article <?php post_class('fotos-article'); ?> id="post-<?php the_ID(); ?> " itemscope="itemscope" itemtype="http://schema.org/BlogPosting" itemprop="blogPost"><?php $loop->post_header(); $loop->post_content(); $loop->post_social(); $loop->post_comments(); ?> </article><?php if ($artsep && is_home()) { echo $artsep; } } } else { echo 'Sorry no posts found'; } }
function render_content() { ?> <?php if (have_posts()) { ?> <div class="loop"> <div class="loop-content"> <?php while (have_posts()) { // The Loop ?> <?php the_post(); ?> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <!-- title, meta, and date info --> <div class="entry-header clearfix"> <h1 class="entry-title"><?php the_title(); ?> </h1> </div> <!-- post content --> <div class="entry-content clearfix"> <?php the_content(); ?> </div> <?php get_search_form(); ?> </div> <!-- end .post --> <?php } // end of one post ?> </div> </div> <?php } else { // do not delete ?> <?php do_action('builder_template_show_not_found'); ?> <?php } // do not delete }
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;}
function thesis_teaser($classes, $post_count = false, $right = false) { $classes = 'teaser'; $post_image = thesis_post_image_info('thumb'); if ($right) { $classes .= ' teaser_right'; } thesis_hook_before_teaser_box($post_count); #hook ?> <div <?php post_class($classes); ?> id="post-<?php the_ID(); ?> "> <?php thesis_build_teaser($post_count, $post_image); ?> </div> <?php thesis_hook_after_teaser_box($post_count); #hook echo $close_box; }
function cases_display_childs_cp() { global $post; $query = new WP_Query('post_type=cases&post_parent=' . $post->ID); if (!is_singular('cases')) { return; } ?> <section id="person_dossier" class="cases-box"> <header class="cases-box-header"> <h1>Досье</h1> <hr> </header> <article class="cases-box-content"> <ul> <?php while ($query->have_posts()) { $query->the_post(); ?> <li role="article" id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <header class="entry-header"> <a href="<?php the_permalink(); ?> "> <h2 class="entry-title"><?php the_title(); ?> </h2> </a> </header> <section id='meta-case'> <ul class="list-inline"> <?php do_action('case_meta_top_add_li'); ?> </ul> </section> </li><!-- #post-<?php the_ID(); ?> --> <?php } wp_reset_postdata(); ?> </ul> </article> </section> <?php }
function widget($args, $instance) { $cache = wp_cache_get('widget_Pending_posts', 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$args['widget_id']])) { return $cache[$args['widget_id']]; } ob_start(); extract($args); $title = empty($instance['title']) ? __('Pending Posts', 'Pending_posts_widget') : apply_filters('widget_title', $instance['title']); if (!($number = (int) $instance['number'])) { $number = 10; } else { if ($number < 1) { $number = 1; } else { if ($number > 15) { $number = 15; } } } $queryArgs = array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'pending', 'caller_get_posts' => 1, 'order' => 'ASC'); $r = new WP_Query($queryArgs); if ($r->have_posts()) { ?> <?php echo $before_widget; ?> <?php echo $before_title . $title . $after_title; ?> <ul> <?php while ($r->have_posts()) { $r->the_post(); ?> <li><?php if (get_the_title()) { the_title(); } else { the_ID(); } edit_post_link('e', ' (', ')'); ?> </li> <?php } ?> </ul> <?php echo $after_widget; wp_reset_query(); // Restore global post data stomped by the_post(). } $cache[$args['widget_id']] = ob_get_flush(); wp_cache_add('widget_Pending_posts', $cache, 'widget'); }
function element() { $title_style = $this->opt('title_style') ? $this->opt('title_style') : 'zn_titleStyle1'; $title = $this->opt('title') ? $this->opt('title') : 'Latest Posts'; $titleAlignment = $this->opt('title_alignment') ? $this->opt('title_alignment') : 'text-left'; $number = $this->opt('items_count') ? $this->opt('items_count') : 3; $category = $this->opt('category') ? $this->opt('category') : ''; //** Appear animation $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : ''; ?> <div class="latestPostsList <?php echo $this->data['uid']; ?> " <?php echo $appear; ?> > <?php echo '<h2 class="zn_title ' . $title_style . ' ' . $titleAlignment . '">' . $title . '</h2>'; ?> <?php //if ( $link_text && is_array( $link ) ) { echo $link['start'] . $link_text . $link['end']; } $args = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true); if (is_array($category)) { $args['cat'] = implode(',', $category); } $r = new WP_Query($args); if ($r->have_posts()) { ?> <ul> <?php while ($r->have_posts()) { $r->the_post(); ?> <li> <a href="<?php the_permalink(); ?> "><?php get_the_title() ? the_title() : the_ID(); ?> </a> </li> <?php } ?> </ul> <?php // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } ?> </div> <?php }
/** * Post gGallery with lightbox ready for use. */ function theme_gallery_lightbox($post_id) { global $post; $thumbnail_ID = get_post_thumbnail_id(); $images = get_children(array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')); if ($images) { ?> <ul class="gallery-list" data-action="gallery-<?php the_ID(); ?> " data-ui-component="gallery"> <?php foreach ($images as $attachment_id => $image) { if ($image->ID != $thumbnail_ID) { $img_alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true); //alt if ($img_alt == '') { $img_alt = $img_title; } $big_array = image_downsize($image->ID, 'full'); $img_url = $big_array[0]; ?> <li class="gallery-item" data-src="<?php echo $image_url; ?> " data-html="<div class='gallery-caption'><h4 class='text-inverse'><?php echo the_title(); ?> </h4><?php echo the_content(); ?> </div>"> <img src="<?php echo $img_url; ?> " alt="<?php echo $img_alt; ?> " title="<?php echo $img_title; ?> " /> </li> <?php } ?> <?php } ?> </ul> <?php } }
function komatsu_menu_template($type = '') { $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $args = array('post_type' => 'menu', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order', 'tax_query' => array(array('taxonomy' => 'courses', 'field' => 'slug', 'terms' => $type))); $the_query = new WP_Query($args); if ($the_query->have_posts()) { ?> <div class="row"> <ul class="menu"> <?php while ($the_query->have_posts()) { $the_query->the_post(); ?> <li id="post-<?php the_ID(); ?> " class="col-xs-10 col-xs-offset-1 col-sm-4 col-sm-offset-0 col-md-3"> <?php if (has_post_thumbnail()) { ?> <?php the_post_thumbnail('thumbnail', array('class' => 'img-responsive col-sm-12 hidden-xs')); ?> <?php } else { ?> <img class="img-responsive col-sm-12 hidden-xs" src="http://placehold.it/200x200/eeeeee/888888"> <?php } ?> <div class="col-sm-12"> <h4><?php the_title(); ?> </h4> <span><?php echo implode(', ', get_field('ingredients')); ?> </span> <p class="price"><?php the_field('price'); ?> </p> </div> <div class="clearfix"></div> </li> <?php } wp_reset_postdata(); ?> </ul> </div> <?php } }
function simple_toolbar() { if (is_user_logged_in()) { //Current User EMail global $current_user; get_currentuserinfo(); $email = $current_user->user_email; $grav_url = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($email))) . "?d=" . urlencode($default) . "&s=" . $size; ?> <nav class="admin-nav"> <a href="/wp-admin/profile.php" target="_blank"> <li style="background-image: url('<?php echo $grav_url; ?> ')"> </li> </a> <a href="/wp-admin/" target="_blank"> <li> <i class="fa fa-home"></i> <nobr>Admin Dashboard</nobr> </li> </a> <a href="/wp-admin/post.php?post=<?php the_ID(); ?> &action=edit" target="_blank"> <li> <i class="fa fa-pencil"></i> <nobr>Edit Page</nobr> </li> </a> <?php if (class_exists('acf')) { ?> <a href="/wp-admin/edit.php?post_type=acf-field-group" target="_blank"> <li> <i class="fa fa-code"></i> <nobr>ACF</nobr> </li> </a> <?php } ?> <a href="/wp-admin/post-new.php" target="_blank"> <li> <i class="fa fa-plus"></i> <nobr>New Post</nobr> </li> </a> </nav> <?php } }
function widget($args, $instance) { extract($args, EXTR_SKIP); global $icon; $icon = $instance['icon']; $title = apply_filters('widget_title', $instance['title']); $number = $instance['number']; /* before widget */ echo $before_widget; /* display title */ if ($title && $icon) { echo $before_title . '<i class="fa ' . $icon . ' "></i>' . $title . $after_title; } elseif ($title) { echo $before_title . $title . $after_title; } /* display the widget */ ?> <div <?php post_class(); ?> id="images-widget-<?php the_ID(); ?> "> <div class="gallery-widget"> <ul> <?php global $post; $args = array('order' => 'DESC', 'post_type' => 'gallery', 'posts_per_page' => 1); $loop = new WP_Query($args); while ($loop->have_posts()) { $loop->the_post(); $images = rwmb_meta('gxg_gallery_images', 'type=image&size=square2', false); $i = 0; foreach ($images as $image) { $imageurl = $image['url']; $imagefull = $image['full_url']; if ($i++ < $number) { echo "<li class='prettyimage-wrap'><a class='pretty_image' title='' data-rel='prettyPhoto[pp_gallery]' href='{$imagefull}'><span class='image-rollover'><i class='gallery-resize-icon fa fa-expand'></i></span><img src='{$imageurl}' alt='' /></a></li>"; } } } wp_reset_query(); ?> </ul> </div><!-- .gallery-widget --> </div><!-- .post-? --> <?php /* after widget */ echo $after_widget; }
public function widget($args, $instance) { if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $number = !empty($instance['number']) ? absint($instance['number']) : 5; if (!$number) { $number = 5; } $args_article = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'order' => $instance['order'], 'orderby' => $instance['orderby']); if (is_array($instance['category'])) { $args_article['category__in'] = $instance['category']; } $r = new WP_Query(apply_filters('widget_posts_args', $args_article)); if ($r->have_posts()) { echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="kt_posts_carousel_widget"> <?php while ($r->have_posts()) { $r->the_post(); ?> <li <?php post_class('article-widget clearfix'); ?> > <?php kt_post_thumbnail_image('kt_widget_article_carousel', 'img-responsive'); ?> <div class="article-attr"> <h3 class="title"> <a href="<?php the_permalink(); ?> "> <?php get_the_title() ? the_title() : the_ID(); ?> </a> </h3> </div> </li> <?php } ?> </ul> <?php echo $args['after_widget']; wp_reset_postdata(); } }
public function widget($args, $instance) { if (!isset($args['widget_id'])) { $args['widget_id'] = $this->id; } $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $number = !empty($instance['number']) ? absint($instance['number']) : 5; if (!$number) { $number = 5; } $args_article = array('posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'order' => $instance['order'], 'orderby' => $instance['orderby']); if (is_array($instance['category'])) { $args_article['category__in'] = $instance['category']; } $r = new WP_Query(apply_filters('widget_posts_args', $args_article)); if ($r->have_posts()) { echo $args['before_widget']; if ($title) { echo $args['before_title'] . $title . $args['after_title']; } ?> <ul class="kt-posts-widget"> <?php while ($r->have_posts()) { $r->the_post(); ?> <li> <?php kt_post_thumbnail_image('kt_small', 'img-responsive'); ?> <div class="content"> <a class="title-link" href="<?php the_permalink(); ?> "><?php get_the_title() ? the_title() : the_ID(); ?> </a> <div class="post-meta"> <span class="post-date">November 18, 2015</span> </div> </div> </li> <?php } ?> </ul> <?php echo $args['after_widget']; // Reset the global $the_post as this query will have stomped on it wp_reset_postdata(); } }
function groupper_get_posts_content() { $posts = get_post_meta(get_the_ID(), 'groupper_get_posts', true); if (isset($posts[0])) { unset($posts[0]); } global $wpdb; ?> <p>Copie e cole este código dentro de um post: <code>[groupper id="<?php the_ID(); ?> "]</code></p> <input type="text" id="get-posts"> <button type="button" id="add-post-to-list" class="button button-primary button-large groupper-save">Adicionar à lista</button> <h2>Lista de posts</h2> <div id="posts-list"> <?php if ($posts) { ksort($posts); foreach ($posts as $position => $post_id) { $post_title = $wpdb->get_var("SELECT post_title FROM {$wpdb->posts} WHERE ID={$post_id}"); ?> <div id="<?php echo $post_id; ?> "> <input type="text" class="post-position" name="post_position<?php echo $post_id; ?> " value="<?php echo $position; ?> " size="2"> <input type="hidden" name="post_id<?php echo $post_id; ?> " value="<?php echo $post_id; ?> " class="post-id"> <span class="post-title"><?php echo $post_title; ?> </span> <i class="dashicons dashicons-no delete-post" id="delete-post-from-list"></i> </div> <?php } } ?> </div> <?php }
function reorder_admin_jobs_callback() { $args = array('post_type' => 'job', 'orderby' => 'menu_order', 'order' => 'ASC', 'post_status' => 'publish', 'no_found_rows' => true, 'update_post_term_cache' => false, 'post_per_post' => 50); $job_listing = new WP_Query($args); ?> <div class="wrap" id="job-sort"> <div id="icon-job-admin" class="icon32"><br/></div> <h2><?php _e('Sort by Positions', 'ax-semantics'); ?> <img src="<?php echo esc_url(admin_url() . '/images/loading.gif'); ?> " alt="" ></h2> <?php if ($job_listing->have_posts()) { ?> <p><?php _e('<strong>Note:</strong>Sort by Positions', 'ax-semantics'); ?> </p> <ul id="custom-type-list"> <?php while ($job_listing->have_posts()) { $job_listing->the_post(); ?> <li id="<?php the_ID(); ?> "> <?php the_title(); ?> </li> <?php } ?> </ul> <?php } else { ?> <p> <?php _e('you have no Jobs', 'ax-semantics'); ?> </p> <?php } ?> </div> <?php }
/** * Displays single product loop * * Uses WooCommerce structure and contains all existing WooCommerce hooks * * Code based on WooCommerce 1.5.5 woocommerce_single_product_content() * @see woocommerce/woocommerce-template.php * * @since 0.9.0 */ function gencwooc_single_product_loop() { do_action('woocommerce_before_main_content'); // Let developers override the query used, in case they want to use this function for their own loop/wp_query $wc_query = false; // Added a hook for developers in case they need to modify the query $wc_query = apply_filters('gencwooc_custom_query', $wc_query); if (!$wc_query) { global $wp_query; $wc_query = $wp_query; } if ($wc_query->have_posts()) { while ($wc_query->have_posts()) { $wc_query->the_post(); ?> <?php do_action('woocommerce_before_single_product'); ?> <div itemscope itemtype="http://schema.org/Product" id="product-<?php the_ID(); ?> " <?php post_class(); ?> > <?php do_action('woocommerce_before_single_product_summary'); ?> <div class="summary"> <?php do_action('woocommerce_single_product_summary'); ?> </div> <?php do_action('woocommerce_after_single_product_summary'); ?> </div> <?php do_action('woocommerce_after_single_product'); } } do_action('woocommerce_after_main_content'); }
function wicked_indexloop() { // load the custom options global $childoptions; foreach ($childoptions as $value) { ${$value}['id'] = get_option($value['id'], $value['std']); } query_posts("posts_per_page=4&cat=" . $wicked_feature_cat); $counter = 1; if (have_posts()) { while (have_posts()) { the_post(); ?> <div id="post-<?php the_ID(); ?> " class="<?php thematic_post_class(); ?> "> <?php thematic_postheader(); if ($counter == 1 && has_post_thumbnail() && !is_paged()) { the_post_thumbnail('homepage-thumbnail'); } ?> <div class="entry-content"> <?php the_excerpt(); ?> <a href="<?php the_permalink(); ?> " class="more"><?php echo more_text(); ?> </a> <?php $counter++; ?> </div> </div><!-- .post --> <?php } } else { ?> <h2>Eek</h2> <p>There are no posts to show!</p> <?php } wp_reset_query(); }
function tool_private_get_node($post_type, $posts, $is_hierarchical = false) { $go_private = get_option(TOOL_PRIVATE_OPTIONS_GO_PRIVATE, "0"); global $post; ?> <ul class="tool-private-box post-type-<?php echo $post_type; ?> "> <?php foreach ($posts as $post) { setup_postdata($post); ?> <li> <input class="tool-private-item" type="checkbox" id="tool-private-item-<?php the_ID(); ?> " name="tool-private-item-<?php the_ID(); ?> " <?php if (tool_private_is_private_post(get_the_ID()) && !empty($go_private) && $go_private == "2") { ?> checked="checked"<?php } ?> /> <label for="tool-private-item-<?php the_ID(); ?> "><?php the_title(); ?> </label> </li> <?php if ($is_hierarchical) { $sub_posts = get_pages(array("post_type" => $post_type, 'numberposts' => -1, "orderby" => "name", "order" => "ASC", "parent" => get_the_ID(), "suppress_filters" => false)); if (!empty($sub_posts)) { tool_private_get_node($post_type, $sub_posts, $is_hierarchical); } } wp_reset_postdata(); } ?> </ul> <?php }
function rt_widget_posts() { $options = get_option("rt_widget_posts"); query_posts('cat=' . $options['category_id']); if (have_posts()) { while (have_posts()) { global $post; the_post(); ?> <div class="post_thumb"><img src="<?php echo get_post_meta($post->ID, 'rt_thumb', TRUE); ?> "</div> <div <?php post_class(); ?> id="post-<?php the_ID(); ?> "> <h3><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h3> <div class="summary"> <?php the_excerpt(); ?> </div> </div> <?php } } else { ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?> </p> <?php } }
function beacon_inject_js() { // session id based username $user = "******" . session_id(); print ' <script type="text/javascript" src="http://beaconpush.com/1/client.js"></script> <script type="text/javascript"> Beacon.connect("' . get_option('beacon_api_key') . '", ["post_'; the_ID(); print '"], {log: true, user: "******"}); Beacon.listen(function(data){ BeaconWordpressPlugin.onNewPost(data); }); </script> '; }
function wicked_indexloop() { query_posts("posts_per_page=4"); $counter = 1; if (have_posts()) { while (have_posts()) { the_post(); ?> <div id="post-<?php the_ID(); ?> " class="<?php thematic_post_class(); ?> "> <?php thematic_postheader(); if ($counter == 1 && has_post_thumbnail() && !is_paged()) { the_post_thumbnail('homepage-thumbnail'); } ?> <div class="entry-content"> <?php the_excerpt(); ?> <a href="<?php the_permalink(); ?> " class="more"><?php echo more_text(); ?> </a> <?php $counter++; ?> </div> </div><!-- .post --> <?php } } else { ?> <h2>Eek</h2> <p>There are no posts to show!</p> <?php } wp_reset_query(); }
function loop_shortcode($atts) { ob_start(); extract(shortcode_atts(array('type' => 'post', 'order' => 'date', 'orderby' => 'title', 'posts' => -1, 'taxonomy' => '', 'term' => '', 'category' => ''), $atts)); // Check if there's a tax and term specified if ($type && $taxonomy && $term) { $options = array('post_type' => $type, 'order' => $order, 'orderby' => $orderby, 'posts_per_page' => $posts, 'tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'slug', 'terms' => $term)), 'category_name' => $category); } else { $options = array('post_type' => $type, 'order' => $order, 'orderby' => $orderby, 'posts_per_page' => $posts, 'category_name' => $category); } $query = new WP_Query($options); if ($query->have_posts()) { ?> <ul class="now-loop"> <?php while ($query->have_posts()) { $query->the_post(); ?> <li id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </li> <?php } wp_reset_postdata(); ?> </ul> <?php $loopvariable = ob_get_clean(); return $loopvariable; } }
/** * Media uploader code changed in Options Framework 1.5 * and no longer uses a custom post type. * * Function removes the post type 'optionsframework' * Media attached to the post type remains in the media library * * @access public * @since 1.5 * @return void */ function optionsframework_update_to_version_1_5() { register_post_type('optionsframework', array('labels' => array('name' => __('Theme Options Media', 'options_framework_theme')), 'show_ui' => false, 'rewrite' => false, 'show_in_nav_menus' => false, 'public' => false)); // Get all the optionsframework post type $query = new WP_Query(array('post_type' => 'optionsframework', 'numberposts' => -1)); while ($query->have_posts()) { $query->the_post(); $attachments = get_children(array('post_parent' => the_ID(), 'post_type' => 'attachment')); if (!empty($attachments)) { // Unassign each of the attachments from the post foreach ($attachments as $attachment) { wp_update_post(array('ID' => $attachment->ID, 'post_parent' => 0)); } } wp_delete_post(the_ID(), true); } wp_reset_postdata(); }