Created
February 8, 2016 19:02
-
-
Save mark-obrien/dba0ea5e6ec31cb79480 to your computer and use it in GitHub Desktop.
Revisions
-
mark-obrien created this gist
Feb 8, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ <?php add_shortcode('nci_careers', 'nci_careers_shortcode'); function nci_careers_shortcode(){ $args = ['post_type'=>'careers', 'numberposts'=>-1, 'post_status'=>'publish']; $careers = get_posts($args); if(! $careers){ return 'Sorry your are sol'; } $html = ''; $html .= '<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">'; foreach($careers as $career) { $html .= '<div class="entry-summary panel panel-default">'; $html .= '<div class="panel-heading" role="tab"> '; $html .= '<h1 class="entry-title panel-title">'; $html .= '<a data-toggle="collapse" data-parent="#accordion" href="#'. $career->ID. '">'. $career->post_title .'</a></h1>'; if ( has_post_thumbnail($career->ID) ) { $html .= '<div style="width:60px;height:60px;overflow:hidden;float:left;">'; $html .= get_the_post_thumbnail($career->ID); $html .='</div>'; } $html .='<div id="'.($career->ID).'" class="panel-collapse collapse">'; $html .='<div class="panel-body">'; $html .='<div class="entry-meta">Posted on <a href="'.get_permalink($career->ID).'">'.get_the_time('F j, Y',$career).'</a></div>'; $html .='<p>'; if(strlen($career->post_content)) { $html .= $career->post_content; } else { $html .= strip_tags(truncate($career->post_content, 380)); } $html .= '</p>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; $html .= '</div>'; } $html .= '</div>'; return $html; }