function subpage_peek($atts, $content = null) { global $post; // Extract shortcode arguements extract(shortcode_atts(array('order' => 'asc', 'orderby' => 'menu_order', 'numpages' => '-1', 'hidethumb' => 'false', 'removelinks' => 'false', 'showfullcontent' => 'false'), $atts)); //query subpages $args = array('post_parent' => $post->ID, 'post_type' => 'page', 'order' => $order, 'orderby' => $orderby, 'posts_per_page' => $numpages); $subpages = new WP_query($args); $i = 1; // create output if ($subpages->have_posts()) { $output = '<div id="subpage-list">'; while ($subpages->have_posts()) { $subpages->the_post(); $output .= '<hr /><div class="entry" id="subpage-link-' . $i . '">'; if ($hidethumb == 'false' && has_post_thumbnail()) { // check if the post has a Post Thumbnail assigned to it. $output .= '<a href="' . get_permalink() . '" class="alignleft">' . get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'wp-post-image')) . '</a>'; } $output .= '<h3>'; $output .= $removelinks == 'true' ? get_the_title() : '<a href="' . get_permalink() . '">' . get_the_title() . '</a>'; $output .= '</h3><p>'; $output .= $showfullcontent == 'true' ? get_the_content() : get_the_excerpt(); if ($removelinks == 'false') { $output .= '<br /><a href="' . get_permalink() . '"><em>Read more »</em></a>'; } $output .= '</p> </div>'; $i++; } $output .= '<div style="clear:both;"></div>'; $output .= '</div>'; } else { $output = '<p>No subpages found.</p>'; } // reset the query wp_reset_postdata(); // return something return $output; }
function widget($args, $instance) { extract($args); $category = isset($instance['category']) ? $instance['category'] : ''; $postcount = empty($instance['postcount']) ? '5' : $instance['postcount']; $offset = empty($instance['offset']) ? '' : $instance['offset']; $sticky = isset($instance['sticky']) ? $instance['sticky'] : 0; echo $before_widget; ?> <section id="slider-<?php echo rand(1, 9999); ?> " class="flexslider"> <ul class="slides"><?php $args = array('posts_per_page' => $postcount, 'cat' => $category, 'offset' => $offset, 'ignore_sticky_posts' => $sticky); $slider = new WP_query($args); while ($slider->have_posts()) { $slider->the_post(); ?> <li> <article class="slide-wrap"> <div class="mh-slider-overlay"></div> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { the_post_thumbnail('content'); } else { echo '<img src="' . get_template_directory_uri() . '/images/noimage_content.png' . '" alt="No Picture" />'; } ?> </a> <header class="slide-caption"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><h2 class="slide-title"><?php the_title(); ?> </h2></a> </header> </article> </li><?php } wp_reset_postdata(); ?> </ul> </section><?php echo $after_widget; }
function image_cpt_shortcode($attr) { if ($attr['page'] <= 10) { $per_page['page'] = $attr['page']; } else { $per_page['page'] = 10; } $output = '<h2 class="winner-title">Hall of Winners</h2><h3 class="winner-subtitle">Congratulations to all of our winners</h3>'; $args = array('post_type' => 'image_post_type', 'posts_per_page' => $per_page['page']); $loop = new WP_query($args); if ($loop->have_posts()) { while ($loop->have_posts()) { $loop->the_post(); $output .= '<div class="winner-div"><h3>'; $output .= get_the_title(); $output .= '</h3>'; if (has_post_thumbnail()) { // check if the post has a post thumbnail assigned to it. $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($loop->ID), 'full'); $url = $thumb['0']; $output .= '<img src="' . $url . '"/>'; } $output .= '</div>'; } } else { // if no content, include the "no posts found" template. get_template_part('content', 'none'); } return $output; }
/** * Projects - Display projects within options page */ function wp_stripe_options_display_projects() { // Query Custom Post Types $args = array('post_type' => 'wp-stripe-projects', 'post_status' => 'publish', 'orderby' => 'meta_value_num', 'meta_key' => 'wp-stripe-completion', 'order' => 'ASC', 'posts_per_page' => 50); // - query - $my_query = null; $my_query = new WP_query($args); while ($my_query->have_posts()) { $my_query->the_post(); $time_format = get_option('time_format'); // - variables - $custom = get_post_custom(get_the_ID()); $id = $my_query->post->ID; $public = $custom["wp-stripe-public"][0]; $live = $custom["wp-stripe-live"][0]; $name = $custom["wp-stripe-name"][0]; $email = $custom["wp-stripe-email"][0]; $content = get_the_content(); $date = $custom["wp-stripe-date"][0]; $cleandate = date('d M', $date); $cleantime = date('H:i', $date); $amount = $custom["wp-stripe-amount"][0]; $fee = $custom["wp-stripe-fee"][0] / 100; $net = round($amount - $fee, 2); echo '<tr>'; // Dot if ($live == 'LIVE') { $dotlive = '<div class="dot-stripe-live"></div>'; } else { $dotlive = '<div class="dot-stripe-test"></div>'; } if ($public == 'YES') { $dotpublic = '<div class="dot-stripe-public"></div>'; } else { $dotpublic = '<div class="dot-stripe-test"></div>'; } // Person $img = get_avatar($email, 32); $person = $img . ' <span class="stripe-name">' . $name . '</span>'; // Received $received = '<span class="stripe-netamount"> + ' . $net . '</span> (-' . $fee . ')'; // Content echo '<td>' . $dotlive . $dotpublic . '</td>'; echo '<td>' . $person . '</td>'; echo '<td>' . $received . '</td>'; echo '<td>' . $cleandate . ' - ' . $cleantime . '</td>'; echo '<td class="stripe-comment">"' . $content . '"</td>'; echo '</tr>'; } }
function mon_espace_pub_show() { $args = array('post_type' => 'slider', 'ignore_sticky_posts' => true); $pub = new WP_query($args); if ($pub->have_posts()) { echo "<div id='pub'>"; while ($pub->have_posts()) { $pub->the_post(); echo "<div class='la_pub'>"; the_post_thumbnail('slider'); echo "</div>"; } echo "</div>"; wp_reset_postdata(); } }
/** * Create a shortcode to insert content of a page of specified ID * * @param array attributes of shortcode * @return string $output Content of page specified, if no page id specified output = null */ function SPD2012_insertPage($atts, $content = null) { // Default output if no pageid given $output = NULL; // extract atts and assign to array extract(shortcode_atts(array("page" => ''), $atts)); // if a page id is specified, then run query if (!empty($page)) { $pageContent = new WP_query(); $pageContent->query(array('pagename' => $page)); while ($pageContent->have_posts()) { $pageContent->the_post(); // assign the content to $output $output = get_the_content(); } } return $output; }
/** * Magazine template function to get headlines * * @return array */ function suffusion_get_headlines() { global $post, $wpdb, $suf_mag_headline_limit; $headlines = array(); $solos = array(); $suf_mag_headline_limit = (int) $suf_mag_headline_limit; $quota_full = false; // Previously the script was loading all posts into memory using get_posts and checking the meta field. This causes the code to crash if the # posts is high. $querystr = "SELECT wposts.*\n\t\tFROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta\n\t\tWHERE wposts.ID = wpostmeta.post_id\n\t AND wpostmeta.meta_key = 'suf_magazine_headline'\n\t AND wpostmeta.meta_value = 'on'\n\t AND wposts.post_status = 'publish'\n\t AND wposts.post_type = 'post'\n\t ORDER BY wposts.post_date DESC\n\t "; $head_posts = $wpdb->get_results($querystr, OBJECT); foreach ($head_posts as $post) { setup_postdata($post); $headlines[] = $post; $solos[] = $post->ID; if (count($headlines) == $suf_mag_headline_limit) { $quota_full = true; break; } } if ($quota_full) { return $headlines; } $headline_categories = suffusion_get_allowed_categories('suf_mag_headline_categories'); if (is_array($headline_categories) && count($headline_categories) > 0) { $query_cats = array(); foreach ($headline_categories as $headline_category) { $query_cats[] = $headline_category->cat_ID; } $query_posts = implode(",", array_values($query_cats)); $cat_query = new WP_query(array('cat' => $query_posts, 'post__not_in' => $solos)); } if (isset($cat_query->posts) && is_array($cat_query->posts)) { while ($cat_query->have_posts()) { $cat_query->the_post(); $headlines[] = $post; if (count($headlines) == $suf_mag_headline_limit) { $quota_full = true; break; } } } return $headlines; }
<div class="container services-wrap"> <?php for ($p = 1; $p < 5; $p++) { ?> <?php if (get_theme_mod('page-column' . $p, false)) { ?> <?php $queryxxx = new WP_query('page_id=' . get_theme_mod('page-column' . $p, true)); ?> <?php while ($queryxxx->have_posts()) { $queryxxx->the_post(); ?> <div class="listpages <?php if ($p % 4 == 0) { echo "last_column"; } ?> "> <a href="<?php the_permalink(); ?> "><?php the_post_thumbnail(); ?>
?> <div id="primary" class="content-area interview"> <main id="main" class="site-main" role="main"> <?php if (function_exists('dimox_breadcrumbs')) { dimox_breadcrumbs(); } ?> <?php $args = array('post_parent' => 103, 'post_type' => 'page', 'paged' => $paged); $subpages = new WP_query($args); if ($subpages->have_posts()) { $output = '<ul class="menu-event-wrapp">'; while ($subpages->have_posts()) { $subpages->the_post(); $output .= '<li><div class="thumb"><a href="' . get_permalink() . '">' . get_the_post_thumbnail() . '</a></div></li>'; } $output .= '</ul>'; } echo $output; wp_reset_postdata(); ?> <?php $title = get_the_title(); $temp = get_cat_ID($title); if ($title == 'Інтерв’ю') { $temp = 10; } $wp_query = null; $wp_query = new WP_Query();
<?php // // custom query to display children of this page ?> <?php $childPosts = new WP_query(array('post_type' => 'page', 'post_parent' => $post->ID, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC')); ?> <?php if ($childPosts->have_posts()) { ?> <div class="container"> <?php while ($childPosts->have_posts()) { $childPosts->the_post(); ?> <?php get_template_part('content'); ?> <?php } ?> </div><!-- .container --> <?php wp_reset_postdata(); ?> <?php
/** * Display Transctions on Options Page * * @since 1.0 * */ function wp_stripe_options_display_trx() { // Paging function retrievePage() { if (!isset($_POST['pagination']) || $_POST['pagination'] == "1") { $paged = 1; } else { $paged = $_POST['pagination']; } return intval($paged); } // Query Custom Post Types $args = array('post_type' => 'wp-stripe-trx', 'post_status' => 'publish', 'orderby' => 'meta_value_num', 'meta_key' => 'wp-stripe-date', 'order' => 'DESC', 'posts_per_page' => 10, 'paged' => retrievePage()); // - query - $my_query = null; $my_query = new WP_query($args); while ($my_query->have_posts()) { $my_query->the_post(); $time_format = get_option('time_format'); // - variables - $custom = get_post_custom(get_the_ID()); $id = $my_query->post->ID; $public = $custom["wp-stripe-public"][0]; $live = $custom["wp-stripe-live"][0]; $name = $custom["wp-stripe-name"][0]; $email = $custom["wp-stripe-email"][0]; $content = get_the_content(); $date = $custom["wp-stripe-date"][0]; $cleandate = date('d M', $date); $cleantime = date('H:i', $date); $amount = $custom["wp-stripe-amount"][0]; $fee = $custom["wp-stripe-fee"][0] / 100; $currency = $custom['wp-stripe-currency'][0]; $net = round($amount - $fee, 2); echo '<tr>'; // Dot if ($live == 'LIVE') { $dotlive = '<div class="dot-stripe-live"></div>'; } else { $dotlive = '<div class="dot-stripe-test"></div>'; } if ($public == 'YES') { $dotpublic = '<div class="dot-stripe-public"></div>'; } else { $dotpublic = '<div class="dot-stripe-test"></div>'; } // Person $img = get_avatar($email, 32); $person = $img . ' <span class="stripe-name">' . $name . '</span>'; // Received $received = '<span class="stripe-netamount"> + ' . $net . '</span> ' . $currency . ' (-' . $fee . ')'; // Content echo '<td>' . $dotlive . $dotpublic . '</td>'; echo '<td>' . $person . '</td>'; echo '<td>' . $received . '</td>'; echo '<td>' . $cleandate . ' - ' . $cleantime . '</td>'; echo '<td class="stripe-comment">"' . $content . '"</td>'; echo '</tr>'; } ?> </table> <div style="clear:both"></div> <?php function totalPages($transactions) { // get total pages if ($transactions > 0) { $totalpages = floor($transactions / 10) + 1; } else { return; } return $totalpages; } $currentpage = retrievePage(); $totalpages = totalPages($my_query->found_posts); if ($currentpage > 1) { echo '<form method="POST" class="pagination">'; echo '<input type="hidden" name="pagination" value="' . (retrievePage() - 1) . '" />'; echo '<input type="submit" value="Previous 10" />'; echo '</form>'; } if ($currentpage < $totalpages) { echo '<form method="POST" class="pagination">'; echo '<input type="hidden" name="pagination" value="' . (retrievePage() + 1) . '" />'; echo '<input type="submit" value="Next 10" />'; echo '</form>'; } echo ' <div style="clear:both"></div>'; }
<?php } ?> </div><!-- /sidebar --> </div><!-- /cf --> <?php if ($projects->have_posts()) { ?> <div class="inner-section"> <h2>Projects</h2> <ul class="box-list full project-list"> <?php while ($projects->have_posts()) { $projects->the_post(); ?> <?php $challenge_id = get_field('challenge_id'); $challenge = get_post($challenge_id); $challenge_other = trim(get_field('challenge_name')); $event_id = get_field('event_id'); $event = get_post($event_id); $event_slug = $event->post_name; $event_search_term = get_query_var('project-event'); if (!$event_search_term || $event_slug == $event_search_term) { $found_projects = true; ?> <li> <div class="box-content"> <h4><a href="<?php
echo '<div id="front-columns-box"><div id="front-columns" class="ppbox">'; if ($nirvana_columnstitle) { echo "<h2>" . do_shortcode($nirvana_columnstitle) . "</h2>"; } dynamic_sidebar('presentation-page-columns-area'); echo "</div></div>"; } else { global $nirvana_column_defaults; nirvana_columns_output($nirvana_column_defaults, $nirvana_nrcolumns); } break; default: if ($nirvana_columnNumber > 0) { if ($custom_query2->have_posts()) { while ($custom_query2->have_posts()) { $custom_query2->the_post(); $img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'columns'); $column['image'] = $img[0]; $column['link'] = get_permalink(); $column['text'] = get_the_excerpt(); $column['title'] = get_the_title(); $columns[] = $column; } } nirvana_columns_output($columns, $nirvana_nrcolumns); } // columnNumber>0 break; } // switch function nirvana_columns_output($columns, $nr_columns)
?> <div class="all-box"> <div class="feature-box-main site-aligner"> <?php for ($f = 1; $f < 5; $f++) { ?> <?php if (get_theme_mod('page-setting' . $f)) { ?> <?php $queryvar = new WP_query('page_id=' . get_theme_mod('page-setting' . $f, true)); ?> <?php while ($queryvar->have_posts()) { $queryvar->the_post(); ?> <div class="feature-box <?php if ($f % 4 == 0) { ?> last<?php } ?> "> <?php the_post_thumbnail(); ?> <div class="feature-title"> <?php the_title(); ?>
<div class="wrapper"> <h4 class="animated fadeIn">My Work</h4> <ul class="portfolioItems"> <?php $portfolio = new WP_query(array('post_type' => 'portfolio')); ?> <?php if ($portfolio->have_posts()) { ?> <?php while ($portfolio->have_posts()) { $portfolio->the_post(); ?> <li class="animated fadeIn"> <div class="portfolioItem"> <div class="portfolioImage"> <?php the_post_thumbnail('portfolio'); ?> </div> <div class="portfolioContent"> <p><?php the_field('description'); ?> </p> <a href="<?php the_field('live_link');
function search_everything_callback() { $is_query = !empty($_GET['s']); $result = array(); if ($is_query) { $result = array('own' => array(), 'external' => array()); $params = array('s' => $_GET['s']); $zemanta_response = se_api(array('method' => 'zemanta.suggest', 'return_images' => 0, 'return_rich_objects' => 0, 'return_articles' => 1, 'return_markup' => 0, 'return_rdf_links' => 0, 'return_keywords' => 0, 'careful_pc' => 1, 'interface' => 'wordpress-se', 'format' => 'json', 'emphasis' => $_GET['s'], 'text' => $_GET['text'])); if (!is_wp_error($zemanta_response) && $zemanta_response['response']['code'] == 200) { $result['external'] = json_decode($zemanta_response['body'])->articles; } $SE = new SearchEverything(true); if (!empty($_GET['exact'])) { $params['exact'] = true; } $params["showposts"] = 5; $post_query = new WP_query($params); while ($post_query->have_posts()) { $post_query->the_post(); $result['own'][] = get_post(); } $post_query->reset_postdata(); } print json_encode($result); die; }
function wp_stripe_delete_tests() { if (isset($_POST['wp_stripe_delete_tests']) && $_POST['wp_stripe_delete_tests'] === '1') { $test_transactions = new WP_query(array('post_type' => 'wp-stripe-trx', 'post_status' => 'publish', 'posts_per_page' => 500)); while ($test_transactions->have_posts()) { $test_transactions->the_post(); // Delete Post if (get_post_meta(get_the_id(), 'wp-stripe-live', true) === 'TEST') { var_dump(the_title()); wp_delete_post(get_the_id(), true); } } wp_redirect(wp_get_referer()); exit; } }
<?php $main_permalink = get_the_permalink(); $userlog = is_user_logged_in(); // Status query $status = new WP_query(array('post_type' => 'status', 'posts_per_page' => 3)); $i = 0; while ($status->have_posts()) { $status->the_post(); $comments = get_comments(array('post_id' => get_the_ID(), 'orderby' => 'post_date', 'order' => 'ASC')); $comment_count = 0; foreach ($comments as $c) { $comment_count++; } $special_class = ''; $i++; if ($i === 1) { $special_class = ' first'; } ?> <div class="status-container<?php echo $special_class; ?> "> <h4><?php the_title(); ?> </h4> <div class="status-posts"> <div class="status-post-count"> <a href="#" class="status-post-count-show-all"><?php
<div class="section-heading mgB20"> <h3 class="section-title text-left">Tin tức Của chúng tôi</h3> </div> <ul class="list-news"> <?php $top_cats = new WP_query(); $top_cats->query('showposts=3&cat=7'); ?> <?php if (have_posts()) { ?> <?php while ($top_cats->have_posts()) { $top_cats->the_post(); ?> <li> <div class="media"> <div class="pull-left"> <a href="<?php the_permalink(); ?> "> <?php if (has_post_thumbnail()) { // Check if thumbnail exists echo get_the_post_thumbnail($post_id, 'thumbnail', array('class' => 'img-responsive w80')); } ?> </a>
if ($the_query->have_posts()) { ?> <div class="module"> <?php if (isset($module_query_args['fw_heading']['title'])) { $module_title = $module_query_args['fw_heading']['title']; if (isset($module_query_args['fw_heading']['link'])) { //die(var_dump($module_query_args['fw_heading']['link'])); $module_title = '<a href="' . $module_query_args['fw_heading']['link'] . '">' . $module_title . '<i class="skin-icon skin-icon-plus"></i></a>'; } echo '<div class="module-heading">' . '<h3 class="module-title">' . $module_title . '</h3>' . '</div>'; } ?> <?php while ($the_query->have_posts()) { $the_query->the_post(); ?> <?php /** * Exclude these post in home page listing */ if (isset($post_to_exclude) && !in_array($post->ID, $post_to_exclude)) { $post_to_exclude[] = $post->ID; } ?> <div <?php post_class('media'); ?> > <?php if (has_post_thumbnail() && !post_password_required()) {
echo 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis malesuada ex non magna convallis aliquam. Nulla ullamcorper elit a ante ullamcorper, nec malesuada <br> massa commodo. In ut nisi nisl. Nullam porta fringilla purus, quis mollis enim tincidunt ut. Praesent vitae lacus ligula. Aliquam efficitur pharetra mauris, in molestie arcu<br> efficitur ornare. Vivamus sed finibus felis, nec cursus lorem.'; ?> </p> <?php } /*Home Section Content*/ ?> <div class="clear"></div> <?php /* Home Four Boxes */ for ($bx = 2; $bx < 6; $bx++) { if (get_theme_mod('page-setting' . $bx)) { $bxquery = new WP_query('page_id=' . get_theme_mod('page-setting' . $bx, true)); while ($bxquery->have_posts()) { $bxquery->the_post(); ?> <a href="<?php the_permalink(); ?> "><div class="feature-box"> <?php the_post_thumbnail(); ?> <h2><?php the_title(); ?> </h2> <?php echo skt_bakery_content(16); ?>
the OGP renewing Australia’s commitment to membership.</p> <p> <a class="btn btn-default" href="https://opengovernment.org.au/2015/11/28/the-prime-ministers-letter-reconfirms-australias-commitment-to-ogp/" title="The Prime Ministers letter reconfirms Australia’s commitment to OGP"> View the letter </a> </p> </div> </div> </div><!-- #home-introduction --> <?php /* Hardcoded page id :S */ $args = array('p' => 2900, 'post_type' => 'page'); $my_query = new WP_query($args); while ($my_query->have_posts()) { $my_query->the_post(); ?> <div class="band" id="draft-plan-released"> <div class="row wide-gutter-row"> <div class="col-sm-12 wide-gutter-col"> <h2><?php the_title(); ?> </h2> <?php the_content(); ?> </div> </div> </div> <?php
if (ot_get_option('news-category-title')) { ?> <span class="breaking"> <?php echo ot_get_option('news-category-title'); ?> </span><?php } ?> <ul id="ticker"> <?php $newscategory = ot_get_option('news-category'); $categorynum = ot_get_option('news-category-num'); $queryObject = new WP_query(array('category__and' => $newscategory, 'posts_per_page' => $categorynum)); if ($queryObject->have_posts()) { while ($queryObject->have_posts()) { $queryObject->the_post(); ?> <li><a href="<?php the_permalink(); ?> "><span><time class="post_date date updated" datetime="<?php the_time('j M, Y'); ?> "><?php echo time_ago(); ?> </time></span> <b class="post-title entry-title"><?php the_title(); ?> </b> </a></li> <?php
function widget($args, $instance) { extract($args); $selected_category = $instance["selected_category"]; $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']); $icon_type = $instance["icon_type"]; $cat_icon_url = $instance["cat_icon_url"]; $post_style = $instance["post_style"]; $post_thumbnail_size = $instance['post_thumbnail_size']; $this->post_excerpt_length = $instance['post_excerpt_length']; $number_of_posts = $instance["number_of_posts"]; $icon_height = $instance['icon_height']; $icon_width = $instance['icon_width']; $all_posts_text = $instance['all_posts_text']; $order = isset($instance['order']) ? $instance['order'] : 'DESC'; $order_by = isset($instance['order_by']) ? $instance['order_by'] : 'date'; $ignore_sticky = isset($instance['ignore_sticky']) ? $instance['ignore_sticky'] : 'ignore'; $post_ids = isset($instance['post_ids']) ? $instance['post_ids'] : ''; $tags = isset($instance['tags']) ? $instance['tags'] : ''; $post_formats = isset($instance['post_formats']) ? $instance['post_formats'] : ''; $any_post_type = isset($instance['any_post_type']) ? $instance['any_post_type'] : false; $separate_widgets = isset($instance['separate_widgets']) ? $instance['separate_widgets'] : false; $ret = ""; if ($icon_type == 'plugin') { if (function_exists('get_cat_icon')) { $cat_icon = get_cat_icon('echo=false&cat=' . $selected_category); if (trim($cat_icon) != '') { $ret .= "\t\t<div class='suf-cat-posts-widget-image' style='height: {$icon_height};'>"; $ret .= $cat_icon; $ret .= "</div>\n"; } } } else { if ($icon_type == 'custom') { if (trim($cat_icon_url) != '') { $ret .= "\t\t<div class='suf-cat-posts-widget-image' style='height: {$icon_height};'>"; $ret .= "<a href='" . get_category_link($selected_category) . "'>"; $ret .= "<img src='{$cat_icon_url}' alt='" . esc_attr($title) . "' title='" . esc_attr($title) . "' style='width: {$icon_width}; height: {$icon_height};'/>"; $ret .= "</a>\n"; $ret .= "</div>\n"; } } } $query_args = array('posts_per_page' => $number_of_posts, 'order' => $order, 'orderby' => $order_by); $tax_query = array('relation' => 'AND'); if ($selected_category != '0' && $selected_category != 0) { $query_args['cat'] = $selected_category; $cat_tax = array('taxonomy' => 'category', 'field' => 'id', 'terms' => array($selected_category), 'operator' => 'IN'); } $post_in = array(); if (trim($post_ids) != '') { $solo_posts = preg_replace('/\\s\\s+/', ' ', $post_ids); $solo_posts = explode(',', $solo_posts); if (count($solo_posts) > 0) { $post_in = $solo_posts; } } if ($ignore_sticky == 'ignore') { $query_args['ignore_sticky_posts'] = true; } else { if ($ignore_sticky == 'only-sticky') { $post_in = get_option('sticky_posts'); } else { $query_args['ignore_sticky_posts'] = false; } } if (is_array($post_in) && count($post_in) > 0) { $query_args['post__in'] = $post_in; } if (trim($tags) != '') { $solo_tags = preg_replace('/\\s\\s+/', ' ', $tags); if (count($solo_tags) > 0) { $query_args['tag'] = $solo_tags; } } if ($post_formats != '') { $format_tax = array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array("post-format-{$post_formats}"), 'operator' => 'IN'); } if (isset($cat_tax) && isset($format_tax)) { $tax_query[] = $cat_tax; $tax_query[] = $format_tax; unset($query_args['cat']); $query_args['tax_query'] = $tax_query; } else { if (isset($cat_tax) || isset($format_tax)) { unset($query_args['cat']); $tax_query = array(isset($cat_tax) ? $cat_tax : $format_tax); $query_args['tax_query'] = $tax_query; } } if ($any_post_type) { $query_args['post_type'] = 'any'; } $query = new WP_query($query_args); if (isset($query->posts) && is_array($query->posts) && count($query->posts) > 0 && !($separate_widgets && ($post_style == 'thumbnail-full' || $post_style == 'thumbnail-excerpt'))) { if ($post_style == 'magazine') { $ret .= "<ul class='suf-cat-posts-list'>\n"; } else { if ($post_style == 'thumbnail' || $post_style == 'thumbnail-excerpt' || $post_style == 'thumbnail-full') { $ret .= "<ul class='suf-posts-thumbnail'>\n"; } else { $ret .= "<ul>\n"; } } while ($query->have_posts()) { $query->the_post(); if ($post_style == 'magazine') { $ret .= "<li class='suf-cat-post'><a href='" . get_permalink() . "' class='suf-cat-post'>" . get_the_title() . "</a></li>\n"; } else { if ($post_style == 'thumbnail') { $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size)); $ret .= "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a></li>\n"; } else { if ($post_style == 'thumbnail-excerpt') { add_filter('excerpt_length', array(&$this, 'excerpt_length')); $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size)); $ret .= "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a>" . suffusion_excerpt(false, false, false) . "</li>\n"; } else { if ($post_style == 'thumbnail-full') { $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size)); $continue = __('Continue reading »', 'suffusion'); $content = get_the_content($continue); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $ret .= "<li class='fix'><div class='suf-widget-thumb'>" . $image . "</div><a href='" . get_permalink() . "' class='suf-widget-thumb-title'>" . get_the_title() . "</a>" . $content . "</li>\n"; } else { if ($post_style == 'thumbnail-only') { $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size, 'no-link' => true)); $ret .= "<li class='suf-widget-mosaic'><div class='suf-widget-thumb'><a href='" . get_permalink() . "' title=\"" . esc_attr(get_the_title()) . "\">" . $image . "</a></div></li>\n"; } else { $ret .= "<li><a href='" . get_permalink() . "'>" . get_the_title() . "</a></li>\n"; } } } } } } wp_reset_query(); $ret .= "</ul>"; } else { if ($separate_widgets && ($post_style == 'thumbnail-full' || $post_style == 'thumbnail-excerpt')) { $original_before_widget = $before_widget; while ($query->have_posts()) { $query->the_post(); $before_widget = preg_replace('/(?<=id=")[^"]+/', '$0-' . get_the_ID(), $original_before_widget); echo $before_widget . "\n"; echo $before_title . get_the_title() . $after_title; if ($post_style == 'thumbnail-full') { $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size)); $continue = __('Continue reading »', 'suffusion'); $content = get_the_content($continue); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo "<div class='suf-widget-thumb'>" . $image . "</div>" . $content . "\n"; } else { add_filter('excerpt_length', array(&$this, 'excerpt_length')); $image = suffusion_get_image(array('widget-thumb' => 'widget-' . $post_thumbnail_size)); echo "<div class='suf-widget-thumb'>" . $image . "</div>" . suffusion_excerpt(false, false, false) . "\n"; } echo $after_widget . "\n"; } wp_reset_query(); return; } } if (trim($all_posts_text)) { $ret .= "\t<div class='suf-mag-category-footer'>\n"; $ret .= "\t\t<a href='" . get_category_link($selected_category) . "' class='suf-mag-category-all-posts'>{$all_posts_text}</a>"; $ret .= "\t</div>\n"; } echo $before_widget; if ($title != '') { $title = do_shortcode($title); echo $before_title . $title . $after_title; } echo $ret; echo $after_widget; }
</div><!-- services-wrap--> <div class="clear"></div> </div><!-- container --> </section><div class="space40"></div> <?php } elseif (is_front_page()) { ?> <!-- Slider Section --> <?php for ($sld = 1; $sld < 4; $sld++) { if (get_theme_mod('page-setting' . $sld)) { $slidequery = new WP_query('page_id=' . get_theme_mod('page-setting' . $sld, true)); while ($slidequery->have_posts()) { $slidequery->the_post(); $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID)); $img_arr[] = $image; $id_arr[] = $post->ID; } } } if (!empty($id_arr)) { ?> <section id="home_slider"> <div class="slider-wrapper theme-default"><div id="slider" class="nivoSlider"> <?php $i = 1; foreach ($img_arr as $url) { ?>
function widget($args, $instance) { extract($args); $category = isset($instance['category']) ? $instance['category'] : ''; $cats = empty($instance['cats']) ? '' : $instance['cats']; $tags = empty($instance['tags']) ? '' : $instance['tags']; $postcount = empty($instance['postcount']) ? '5' : $instance['postcount']; $offset = empty($instance['offset']) ? '' : $instance['offset']; $order = isset($instance['order']) ? $instance['order'] : 'date'; $width = isset($instance['width']) ? $instance['width'] : 'large'; $layout = isset($instance['layout']) ? $instance['layout'] : 'layout1'; $excerpt_length = empty($instance['excerpt_length']) ? '175' : $instance['excerpt_length']; $sticky = isset($instance['sticky']) ? $instance['sticky'] : 1; $excerpt = isset($instance['excerpt']) ? $instance['excerpt'] : 0; if ($cats) { $category = $category . ', ' . $cats; } echo $before_widget; ?> <section id="slider-<?php echo rand(1, 9999); ?> " class="flexslider <?php echo 'slider-' . $width . ' slider-' . $layout; ?> "> <ul class="slides"><?php $args = array('posts_per_page' => $postcount, 'cat' => $category, 'tag' => $tags, 'offset' => $offset, 'orderby' => $order, 'ignore_sticky_posts' => $sticky); $slider = new WP_query($args); while ($slider->have_posts()) { $slider->the_post(); ?> <li> <article class="slide-wrap"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php if (has_post_thumbnail()) { if ($width == 'large') { the_post_thumbnail('slider'); } else { the_post_thumbnail('content'); } } else { if ($width == 'large') { echo '<img class="mh-image-placeholder" src="' . get_template_directory_uri() . '/images/noimage_940x400.png' . '" alt="No Picture" />'; } else { echo '<img class="mh-image-placeholder" src="' . get_template_directory_uri() . '/images/noimage_620x264.png' . '" alt="No Picture" />'; } } ?> </a> <div class="slide-caption"> <div class="slide-data"> <a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><h2 class="slide-title"><?php the_title(); ?> </h2></a> <?php if ($excerpt == 0) { ?> <?php mh_excerpt($excerpt_length); ?> <?php } ?> </div> </div> </article> </li><?php } wp_reset_postdata(); ?> </ul> </section><?php echo $after_widget; }
');"></span> <?php } ?> <?php } wp_reset_postdata(); ?> <div class="slide-right"> <header> <h2>Latest Case Study</h2> <?php $query_post = new WP_query(); $query_post->query('post_type=page&page_id=34'); while ($query_post->have_posts()) { $query_post->the_post(); ?> <h3><a href="<?php echo the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h3> <?php $excerpt = get_field('case_study_excerpt'); if (!empty($excerpt)) { ?> <?php echo $excerpt; ?>
/** * 固定ページで子ページのリンクやタイトル、抜粋を一覧表示させるショートコード */ function st_stchildlink() { global $post; $args = array('post_parent' => $post->ID, 'post_type' => 'page'); $subpages = new WP_query($args); if ($subpages->have_posts()) { $output = '<aside class="pagelist-box"><h4 class="kanrenh4">【関連コンテンツ】</h4><ul class="st-childlink">'; while ($subpages->have_posts()) { $subpages->the_post(); $output .= '<li><strong><a href="' . esc_url(apply_filters('the_permalink', get_permalink())) . '">' . get_the_title() . '</a></strong>' . '<p>' . apply_filters('the_excerpt', get_the_excerpt()) . '</p></li>'; } $output .= '</ul></aside>'; } else { $output = ''; } wp_reset_postdata(); return $output; }
</a></li> <?php } ?> </ul> </div> <?php } else { ?> <div class="sidebar_right"> <h4>MORE NEWS</h4> <ul> <?php $sidebarNews = new WP_query(array('post_type' => 'post', 'posts_per_page' => 5)); while ($sidebarNews->have_posts()) { $sidebarNews->the_post(); ?> <li><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></li> <?php } ?> </ul> </div> <?php }
echo '<li><a href="' . $main_link . '">membership levels</a></li>'; ?> <?php echo $children; ?> </ul> <?php } ?> <div class="entry-content"> <?php if (!$post->post_parent) { $member_options = new WP_query('post_type=member'); if ($member_options->have_posts()) { while ($member_options->have_posts()) { $member_options->the_post(); ?> <?php if (in_category('institutional')) { ?> <h2 class="featured">Institutional Memberships</h2> <div class="one_one"> <ul> <li class="membership_info"> <h3 class="news-title"><?php the_title(); ?> </h3> <?php the_content(); ?>