Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function services_shortcode($atts, $content = null) {
- extract(shortcode_atts(array(
- ), $atts));
- $q = new WP_Query(
- array('posts_per_page' => '4', 'post_type' => 'services')
- );
- $list .= '';
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $emedic = get_post_meta($idd, 'emedic', true);
- $list .= '';
- endwhile;
- $list .= '';
- wp_reset_query();
- return $list;
- }
- add_shortcode('servicepost', 'services_shortcode');
- function mix_content_shortcode($atts, $content = null) {
- extract(shortcode_atts(array(
- 'count' => '',
- 'category' => '',
- ), $atts));
- $q = new WP_Query(
- array('posts_per_page' => $count, 'post_type' => 'mixitup_item', 'mixit_cat' => $category)
- );
- $list .= '<div id="worksGrid">';
- while($q->have_posts()) : $q->the_post();
- $idd = get_the_ID();
- $image_id = get_post_thumbnail_id();
- $image_url = wp_get_attachment_image_src($image_id,'thumbimage');
- $image_thmb = $image_url[0];
- $mixcategory = get_post_meta($idd, 'mixcategory', true);
- $mixsubtitle = get_post_meta($idd, 'mixsubtitle', true);
- $mixlargeimage = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'mlimage');
- $list .= '
- <div class="col-md-4 col-sm-4 col-xs-12 worksItem '.$mixcategory.'">
- <img src="'.$image_thmb.'" alt="">
- <div class="itemCaption">
- <div class="capContent">
- <h3>'.get_the_title().'</h3>
- <p>'.$mixsubtitle.'</p>
- <a class="capPreview image-modal" href="#image-modal'.get_the_ID().'">Preview</a>
- </div>
- </div>
- <div id="image-modal'.get_the_ID().'" class="mfp-hide modal-box">
- <img src="'.$mixlargeimage[0].'" alt="">
- <div class="modal-box-content">
- <h2>'.get_the_title().'</h2>
- <p>'.get_the_content().'</p>
- </div>
- </div>
- </div>
- ';
- endwhile;
- $list .= '</div>';
- wp_reset_query();
- return $list;
- }
- add_shortcode('portfolioitem', 'mix_content_shortcode');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment