'Testimonials', 'singular_name' => 'Testimonials', 'menu_name' => 'Testimonials', 'parent_item_colon' => 'Parent Testimonial:', 'all_items' => 'All Testimonials', 'view_item' => 'View Testimonial', 'add_new_item' => 'Add New Testimonial', 'add_new' => 'New Testimonial', 'edit_item' => 'Edit Testimonial', 'update_item' => 'Update Testimonial', 'search_items' => 'Search Testimonials', 'not_found' => 'No Testimonials found', 'not_found_in_trash' => 'No Testimonials found in Trash', ); $args = array( 'label' => 'Testimonials', 'description' => 'Testimonials post type', 'labels' => $labels, 'supports' => array( 'title', 'excerpt', 'thumbnail', 'revisions', 'page-attributes', 'editor'), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 5, 'can_export' => true, 'has_archive' => false, 'exclude_from_search' => false, 'capability_type' => 'page', 'menu_icon' => plugins_url( 'gm_icon_bw.png', __FILE__ ), ); register_post_type( 'testimonials', $args ); } // Hook into the 'init' action add_action( 'init', 'create_testimonials', 0 ); ?> 'testimonials_extra', 'title' => 'Profile Info', 'pages' => array( 'testimonials' ), 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => 'Location', 'id' => "gm_testimonials_location", 'desc' => 'Example: San Diego, CA', 'type' => 'text', 'std' => '', ), array( 'name' => 'Date', 'id' => "gm_testimonials_date", 'type' => 'date', // jQuery date picker options. See here http://jqueryui.com/demos/datepicker 'js_options' => array( 'appendText' => '(yyyy-mm-dd)', 'dateFormat' => 'yy-mm-dd', 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true, ), ), ), 'validation' => array( 'rules' => array( "gm_testimonials_location" => array( 'required' => true, ), "post_title" => array( 'required' => true, ), ), 'messages' => array( "gm_testimonials_location" => array( 'required' => 'Location is required', ), ) ) ); function gm_testimonials_register_meta_boxes() { if ( !class_exists( 'RW_Meta_Box' ) ) return; global $gm_testimonials_meta_boxes; foreach ( $gm_testimonials_meta_boxes as $meta_box ) { new RW_Meta_Box( $meta_box ); } } add_action( 'admin_init', 'gm_testimonials_register_meta_boxes' ); 'date', // by post date 'order' => 'DESC', // newest first by default 'meta_key' => '', // meta_key 'display' => 'content', ), $atts ) ); $db_args = array( 'post_type' => 'testimonials', 'order' => $order, 'orderby' => $orderby, 'meta_key' => $meta_key, ); $date_format = "M d, Y"; $testimonials_loop = new WP_Query( $db_args ); if($testimonials_loop->have_posts()) { switch($display) { case "content": $content .= "
"; while( $testimonials_loop->have_posts() ) : $testimonials_loop->the_post(); $formatted_date = date($date_format, strtotime($raw_date)); $content_filtered = get_the_content(); $content_filtered = apply_filters('the_content', $content_filtered); $content_filtered = str_replace(']]>', ']]>', $content_filtered); $content .= "
"; $content .= "
$content_filtered
"; $content .= "
".rwmb_meta( 'gm_testimonials_location' )."
"; //$content .= "
".$formatted_date."
"; $content .= "
".get_the_title().""; $content .= "
"; endwhile; $content .= "
"; break; case "excerpt": $content .= "
"; while( $testimonials_loop->have_posts() ) : $testimonials_loop->the_post(); $formatted_date = date($date_format, strtotime($raw_date)); $content .= "
"; $content .= "
".get_the_title()."
"; $content .= "
".get_the_excerpt()."
"; $content .= "
"; endwhile; $content .= "
"; break; case "list": $content .= ""; break; } } $wp_query = null; $wp_query = $original_query; wp_reset_postdata(); return $content; } add_shortcode( 'gm_testimonials', 'gm_testimonials_shortcode' ); 1.0Bolthttps://www.boltpos.comAbdelkader Smireshttps://www.boltpos.com/author/asmires/Homerich600338<blockquote class="wp-embedded-content" data-secret="VAeulR8mEA"><a href="https://www.boltpos.com/">Home</a></blockquote><iframe sandbox="allow-scripts" security="restricted" src="https://www.boltpos.com/embed/#?secret=VAeulR8mEA" width="600" height="338" title="“Home” — Bolt" data-secret="VAeulR8mEA" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe><script type="text/javascript"> /* <![CDATA[ */ /*! This file is auto-generated */ !function(d,l){"use strict";l.querySelector&&d.addEventListener&&"undefined"!=typeof URL&&(d.wp=d.wp||{},d.wp.receiveEmbedMessage||(d.wp.receiveEmbedMessage=function(e){var t=e.data;if((t||t.secret||t.message||t.value)&&!/[^a-zA-Z0-9]/.test(t.secret)){for(var s,r,n,a=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),o=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]'),c=new RegExp("^https?:$","i"),i=0;i<o.length;i++)o[i].style.display="none";for(i=0;i<a.length;i++)s=a[i],e.source===s.contentWindow&&(s.removeAttribute("style"),"height"===t.message?(1e3<(r=parseInt(t.value,10))?r=1e3:~~r<200&&(r=200),s.height=r):"link"===t.message&&(r=new URL(s.getAttribute("src")),n=new URL(t.value),c.test(n.protocol))&&n.host===r.host&&l.activeElement===s&&(d.top.location.href=t.value))}},d.addEventListener("message",d.wp.receiveEmbedMessage,!1),l.addEventListener("DOMContentLoaded",function(){for(var e,t,s=l.querySelectorAll("iframe.wp-embedded-content"),r=0;r<s.length;r++)(t=(e=s[r]).getAttribute("data-secret"))||(t=Math.random().toString(36).substring(2,12),e.src+="#?secret="+t,e.setAttribute("data-secret",t)),e.contentWindow.postMessage({message:"ready",secret:t},"*")},!1)))}(window,document); /* ]]> */ </script>