Created
March 24, 2015 17:08
-
-
Save coffe67/b1657367d62b85f32692 to your computer and use it in GitHub Desktop.
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 characters
/** | |
* Registry of Actions for Custom Post Types & Custom Field Types | |
* @since Hadron 1.0 | |
*/ | |
/** Theme Options */ | |
add_theme_support( 'post-thumbnails' ); | |
//add_image_size('slider_home', 1380, 800, true); | |
/** Actions **/ | |
add_action( 'init', 'create_post_type' ); | |
add_action("admin_init", "admin_init"); | |
add_action("add_meta_boxes","download_file_meta"); | |
/* Save Actions */ | |
add_action('save_post', 'save_partner_link'); | |
add_action('save_post', 'save_event_info'); | |
add_action('save_post', 'save_campaing_info'); | |
add_action('save_post', 'save_home_slides'); | |
add_action('save_post', 'save_members'); | |
/* Manage Actions */ | |
add_action("manage_posts_custom_column", "partner_custom_columns"); | |
add_action("manage_posts_custom_column", "events_custom_columns"); | |
add_action("manage_posts_custom_column", "campaings_custom_columns"); | |
add_action("manage_posts_custom_column", "members_custom_columns"); | |
add_action("manage_posts_custom_column", "slider_home_custom_columns"); | |
/** Filters **/ | |
add_filter("manage_edit-hadron_partnerships_columns", "partner_edit_columns"); | |
add_filter("manage_edit-hadron_event_columns", "events_edit_columns"); | |
add_filter("manage_edit-hadron_campaings_columns", "campaings_edit_columns"); | |
add_filter("manage_edit-hadron_members_columns", "members_edit_columns"); | |
add_filter("manage_edit-hadron_slider_columns", "slider_home_edit_columns"); | |
/** | |
* Admin Init, Function to define METAS for Custom Post Types & Custom Post Fields | |
* @since Hadron 1.0 | |
*/ | |
function admin_init(){ | |
add_meta_box("partnersInfo-meta", "Partnerships Options", "partners_meta_options", "hadron_partnerships", "side", "low"); | |
add_meta_box("eventsInfo-meta", "Event Options", "events_meta_options", "hadron_event", "side", "low"); | |
add_meta_box("eventsMapInfo-meta", "Event Location", "events_map_meta_options", "hadron_event", "advanced", "low"); | |
add_meta_box("campaingInfo-meta", "Campaing Options", "campaings_meta_options", "hadron_campaings", "side", "low"); | |
add_meta_box("campaingMapInfo-meta", "Campaing Location", "events_map_meta_options", "hadron_campaings", "advanced", "low"); | |
add_meta_box("memebrsInfo-meta", "Members Options", "members_meta_options", "hadron_members", "side", "low"); | |
add_meta_box("sliderInfo-meta", "Home Slide Options", "home_slides_meta_options", "hadron_slider", "side", "low"); | |
} | |
// function kind_of_page(){ | |
// global $post; | |
// $template_file = get_post_meta($post->ID,'_wp_page_template',TRUE); | |
// } | |
/** | |
* Pages Metas | |
*/ | |
function download_file_meta(){ | |
global $post; | |
$template_file = get_post_meta($post->ID,'_wp_page_template',TRUE); | |
if ($template_file == 'hadron_what_is.php') { | |
add_meta_box("downloadFile-meta", "Hadron File Download Options", "hadron_file_download_meta_options", "page", "side", "low"); | |
} | |
} | |
/** | |
* Custom Field Types | |
* @since Hadron 1.0 | |
*/ | |
/** hadron_file_download_meta_options**/ | |
function hadron_file_download_meta_options(){ | |
global $post; | |
$custom = get_post_custom($post->ID); | |
$link_url = $custom["link_url"][0]; | |
?> | |
<label>Link to: </label><br/><input name="link_url" value="<?php echo $link_url; ?>" /> | |
<?php | |
} | |
/** Home Sileder Images**/ | |
function home_slides_meta_options(){ | |
global $post; | |
$custom = get_post_custom($post->ID); | |
$link_url = $custom["link_url"][0]; | |
?> | |
<label>Link to: </label><br/><input name="link_url" value="<?php echo $link_url; ?>" /> | |
<?php | |
} | |
function save_home_slides(){ | |
global $post; | |
update_post_meta($post->ID, "link_url", $_POST["link_url"]); | |
} | |
/** Partnerships **/ | |
function partners_meta_options(){ | |
global $post; | |
$custom = get_post_custom($post->ID); | |
$link_url = $custom["link_url"][0]; | |
?> | |
<label>Link to:</label><br/><input name="link_url" value="<?php echo $link_url; ?>" /> | |
<?php | |
} | |
function save_partner_link(){ | |
global $post; | |
update_post_meta($post->ID, "link_url", $_POST["link_url"]); | |
} | |
/** Members **/ | |
function members_meta_options(){ | |
global $post; | |
$custom = get_post_custom($post->ID); | |
$link_url = $custom["link_url"][0]; | |
$email = $custom["email"][0]; | |
$position = $custom["position"][0]; | |
$phone = $custom["phone"][0]; | |
$mobile = $custom["mobile"][0]; | |
?> | |
<label>E-Mail: </label><br/><input name="email" value="<?php echo $email; ?>" placeholder = "[email protected]"/><br/> | |
<label>Position: </label><br/><input name="position" value="<?php echo $position; ?>" /><br/> | |
<label>Phone: </label><br/><input name="phone" value="<?php echo $phone; ?>" placeholder = "(##) #### ####" /><br/> | |
<label>Mobile: </label><br/><input name="mobile" value="<?php echo $mobile; ?>" placeholder="(###) ## ## #### ##" /><br/> | |
<label>Link to: </label><br/><input name="link_url" value="<?php echo $link_url; ?>" placeholder="http://www.site.com"/> | |
<?php | |
} | |
function save_members(){ | |
global $post; | |
update_post_meta($post->ID, "link_url", $_POST["link_url"]); | |
update_post_meta($post->ID, "email", $_POST["email"]); | |
update_post_meta($post->ID, "position", $_POST["position"]); | |
update_post_meta($post->ID, "phone", $_POST["phone"]); | |
update_post_meta($post->ID, "mobile", $_POST["mobile"]); | |
} | |
/** Campaings **/ | |
function campaings_meta_options(){ | |
global $post; | |
$months= array('January','February','April','May','June','July','Agust','October','September','November','Dicember' ); | |
$custom = get_post_custom($post->ID); | |
$link_url = $custom["link_url"][0]; | |
$starting_date_month = $custom["starting_date_month"][0]; | |
$starting_date_day = $custom["starting_date_day"][0]; | |
$starting_date_year = $custom["starting_date_year"][0]; | |
$ending_date_month = $custom["ending_date_month"][0]; | |
$ending_date_day = $custom["ending_date_day"][0]; | |
$ending_date_year = $custom["ending_date_year"][0]; | |
?> | |
<label>Link to: </label> <br/> | |
<input name="link_url" value="<?php echo $link_url; ?>" /> <br /> | |
<label>Starting Date: </label><br/> | |
<div class="timestamp-wrap"> | |
<select name="starting_date_month"> | |
<?php | |
foreach ($months as $clave => $valor) { | |
if ($starting_date_month){ | |
if ($clave != $starting_date_month){ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
}else{ | |
echo '<option value="'.$clave.'" selected="selected">'.$valor.'</option>'; | |
} | |
}else{ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
} | |
} | |
?> | |
</select> | |
<input type="text" id="jj" name="starting_date_day" value="<?php echo $starting_date_day;?>" size="2" maxlength="2" autocomplete="off" placeholder="dd">, | |
<input type="text" id="aa" name="starting_date_year" value="<?php echo $starting_date_year?>" size="4" maxlength="4" autocomplete="off" placeholder="yyyy"> | |
</div> | |
<br/> | |
<label>Ending Date: </label><br/> | |
<div class="timestamp-wrap"> | |
<select name="ending_date_month"> | |
<?php | |
foreach ($months as $clave => $valor) { | |
if ($ending_date_month){ | |
if ($clave != $ending_date_month){ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
}else{ | |
echo '<option value="'.$clave.'" selected="selected">'.$valor.'</option>'; | |
} | |
}else{ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
} | |
} | |
?> | |
</select> | |
<input type="text" id="jj" name="ending_date_day" value="<?php echo $ending_date_day;?>" size="2" maxlength="2" autocomplete="off" placeholder="dd">, | |
<input type="text" id="aa" name="ending_date_year" value="<?php echo $ending_date_year?>" size="4" maxlength="4" autocomplete="off" placeholder="yyyy"> | |
</div> | |
<?php | |
} | |
function save_campaing_info(){ | |
global $post; | |
update_post_meta($post->ID, "link_url", $_POST["link_url"]); | |
// Starting Date | |
update_post_meta($post->ID, "starting_date_month", $_POST["starting_date_month"]); | |
update_post_meta($post->ID, "starting_date_day", $_POST["starting_date_day"]); | |
update_post_meta($post->ID, "starting_date_year", $_POST["starting_date_year"]); | |
// Ending Date | |
update_post_meta($post->ID, "ending_date_month", $_POST["ending_date_month"]); | |
update_post_meta($post->ID, "ending_date_day", $_POST["ending_date_day"]); | |
update_post_meta($post->ID, "ending_date_year", $_POST["ending_date_year"]); | |
// Location | |
update_post_meta($post->ID, "lat", $_POST["lat"]); | |
update_post_meta($post->ID, "lng", $_POST["lng"]); | |
update_post_meta($post->ID, "place_name", $_POST["place_name"]); | |
update_post_meta($post->ID, "place_address", $_POST["place_address"]); | |
} | |
/** Events **/ | |
function events_map_meta_options(){ | |
global $post; | |
$custom = get_post_custom($post->ID); | |
$lat = $custom["lat"][0]; | |
$lng = $custom["lng"][0]; | |
$place_name = $custom["place_name"][0]; | |
$place_address = $custom["place_address"][0]; | |
?> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<script type="text/javascript" src="../wp-content/themes/<?php echo get_template(); ?>/js/admin-map.js"></script> | |
<script type="text/javascript"> | |
$(function() { | |
var marker, | |
lat = $(".lat").val(), | |
lng = $(".lng").val(); | |
var myOptions = { | |
zoom: 11, | |
center: center_map(lat,lng) | |
} | |
var map = new google.maps.Map(document.getElementById("map"),myOptions); | |
function setLatLng(lat, lng){ | |
$(".lat").val(lat) | |
$(".lng").val(lng) | |
} | |
function addMarker(marker_info, marker_exist){ | |
place = marker_info; | |
if(marker_exist){ | |
place = new google.maps.LatLng(marker_info[0], marker_info[1]) | |
} | |
marker = new google.maps.Marker({ | |
position: place, | |
map: map, | |
draggable: true, | |
icon: '../wp-content/themes/<?php echo get_template(); ?>/images/Base-Map-32.png', | |
}); | |
setLatLng(lat, lng) | |
} | |
function placeMarker(location) { | |
if (marker) { | |
marker.setPosition(location); | |
} else { | |
addMarker(location, false) | |
} | |
setLatLng(location.lat(), location.lng()) | |
} | |
function center_map(lat,lng){ | |
if (lat && lng){ | |
center = new google.maps.LatLng(lat,lng) | |
} | |
else{ | |
center = new google.maps.LatLng(20.673792,-103.3354131) | |
} | |
return center | |
} | |
if(lat && lng){ | |
addMarker([lat, lng], true) | |
} | |
if(marker){ | |
google.maps.event.addListener(marker,'dragend',function(event) { | |
setLatLng(event.latLng.lat(), event.latLng.lng()) | |
}); | |
} | |
google.maps.event.addListener(map, "click", function(event) { | |
placeMarker(event.latLng); | |
}); | |
}); | |
</script> | |
<div> | |
<label>Place Name:</label><br/> | |
<input type="text" name="place_name" value="<?php echo $place_name; ?>"><br/> | |
<label>Address:</label><br/> | |
<input type="text" name="place_address" value="<?php echo $place_address; ?>"><br/> | |
<h4>Click to map for add new location marker!</h4> | |
<input type="hidden" class="lat" name="lat" value="<?php echo $lat; ?>"/> | |
<input type="hidden" class="lng" name="lng" value="<?php echo $lng; ?>"/> | |
</div> | |
<div id="map" style="height:400px;"> | |
</div> | |
<?php | |
} | |
function events_meta_options(){ | |
global $post; | |
$months= array('January','February','April','May','June','July','Agust','October','September','November','Dicember' ); | |
$custom = get_post_custom($post->ID); | |
$link_url = $custom["link_url"][0]; | |
$starting_date_month = $custom["starting_date_month"][0]; | |
$starting_date_day = $custom["starting_date_day"][0]; | |
$starting_date_year = $custom["starting_date_year"][0]; | |
$ending_date_month = $custom["ending_date_month"][0]; | |
$ending_date_day = $custom["ending_date_day"][0]; | |
$ending_date_year = $custom["ending_date_year"][0]; | |
?> | |
<label>Link to: </label> <br/> | |
<input name="link_url" value="<?php echo $link_url; ?>" /> <br /> | |
<label>Starting Date: </label><br/> | |
<div class="timestamp-wrap"> | |
<select name="starting_date_month"> | |
<?php | |
foreach ($months as $clave => $valor) { | |
if ($starting_date_month){ | |
if ($clave != $starting_date_month){ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
}else{ | |
echo '<option value="'.$clave.'" selected="selected">'.$valor.'</option>'; | |
} | |
}else{ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
} | |
} | |
?> | |
</select> | |
<input type="text" id="jj" name="starting_date_day" value="<?php echo $starting_date_day;?>" size="2" maxlength="2" autocomplete="off" placeholder="dd">, | |
<input type="text" id="aa" name="starting_date_year" value="<?php echo $starting_date_year?>" size="4" maxlength="4" autocomplete="off" placeholder="yyyy"> | |
</div> | |
<br/> | |
<label>Ending Date: </label><br/> | |
<div class="timestamp-wrap"> | |
<select name="ending_date_month"> | |
<?php | |
foreach ($months as $clave => $valor) { | |
if ($ending_date_month){ | |
if ($clave != $ending_date_month){ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
}else{ | |
echo '<option value="'.$clave.'" selected="selected">'.$valor.'</option>'; | |
} | |
}else{ | |
echo '<option value="'.$clave.'">'.$valor.'</option>'; | |
} | |
} | |
?> | |
</select> | |
<input type="text" id="jj" name="ending_date_day" value="<?php echo $ending_date_day;?>" size="2" maxlength="2" autocomplete="off" placeholder="dd">, | |
<input type="text" id="aa" name="ending_date_year" value="<?php echo $ending_date_year?>" size="4" maxlength="4" autocomplete="off" placeholder="yyyy"> | |
</div> | |
<?php | |
} | |
function save_event_info(){ | |
global $post; | |
update_post_meta($post->ID, "link_url", $_POST["link_url"]); | |
// Starting Date | |
update_post_meta($post->ID, "starting_date_month", $_POST["starting_date_month"]); | |
update_post_meta($post->ID, "starting_date_day", $_POST["starting_date_day"]); | |
update_post_meta($post->ID, "starting_date_year", $_POST["starting_date_year"]); | |
// Ending Date | |
update_post_meta($post->ID, "ending_date_month", $_POST["ending_date_month"]); | |
update_post_meta($post->ID, "ending_date_day", $_POST["ending_date_day"]); | |
update_post_meta($post->ID, "ending_date_year", $_POST["ending_date_year"]); | |
// Location | |
update_post_meta($post->ID, "lat", $_POST["lat"]); | |
update_post_meta($post->ID, "lng", $_POST["lng"]); | |
update_post_meta($post->ID, "place_name", $_POST["place_name"]); | |
update_post_meta($post->ID, "place_address", $_POST["place_address"]); | |
} | |
/** | |
* Custom Post Type Hadron | |
* @since Hadron 1.0 | |
*/ | |
function create_post_type() { | |
register_post_type( 'hadron_news', | |
array( | |
'labels' => array( | |
'name' => __( 'Hadron News' ), | |
'singular_name' => __( 'Hadron News' ) | |
), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), | |
'rewrite' => array( 'slug' => 'hadron_news','with_front' => FALSE), | |
'public' => true, | |
'has_archive' => true, | |
) | |
); | |
register_post_type( 'hadron_members', | |
array( | |
'labels' => array( | |
'name' => __( 'Hadron Members' ), | |
'singular_name' => __( 'Hadron Members' ) | |
), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), | |
'rewrite' => array( 'slug' => 'hadron_members','with_front' => FALSE), | |
'public' => true, | |
'has_archive' => true, | |
) | |
); | |
register_post_type( 'hadron_event', | |
array( | |
'labels' => array( | |
'name' => __( 'Hadron Event' ), | |
'singular_name' => __( 'Hadron Events' ) | |
), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), | |
'rewrite' => array( 'slug' => 'hadron_event','with_front' => FALSE), | |
'public' => true, | |
'has_archive' => true, | |
) | |
); | |
register_post_type( 'hadron_campaings', | |
array( | |
'labels' => array( | |
'name' => __( 'Hadron Campaings' ), | |
'singular_name' => __( 'Hadron Campaings' ) | |
), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), | |
'rewrite' => array( 'slug' => 'hadron_campaings','with_front' => FALSE), | |
'public' => true, | |
'has_archive' => true, | |
) | |
); | |
register_post_type( 'hadron_partnerships', | |
array( | |
'labels' => array( | |
'name' => __( 'Hadron Partnerships' ), | |
'singular_name' => __( 'Hadron Partnerships' ) | |
), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), | |
'rewrite' => array( 'slug' => 'hadron_partnerships','with_front' => FALSE), | |
'public' => true, | |
'has_archive' => true, | |
) | |
); | |
register_post_type( 'hadron_slider', | |
array( | |
'labels' => array( | |
'name' => __( 'Hadron Slider' ), | |
'singular_name' => __( 'Hadron Slider' ) | |
), | |
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions' ), | |
'rewrite' => array( 'slug' => 'hadron_slider','with_front' => FALSE), | |
'public' => true, | |
'has_archive' => true, | |
) | |
); | |
} | |
/** | |
* Custom Categories & Columns | |
* @since Hadron 1.0 | |
*/ | |
/* If They Ask for categories about partners */ | |
#register_taxonomy("catalog", array("hadron_partnerships"), array("hierarchical" => true, "label" => "Partner", "singular_label" => "Partners", "rewrite" => true)); | |
/** | |
* Home Slider | |
*/ | |
function slider_home_edit_columns($columns){ | |
$columns = array( | |
"cb" => "<input type=\"checkbox\" />", | |
"title" => "Slide Name", | |
"slide_featured_image" => "Image", | |
"slide_link_url" => "Link To", | |
//"catalog" => "Catalog", | |
); | |
return $columns; | |
} | |
function slider_home_custom_columns($column){ | |
global $post; | |
$custom = get_post_custom(); | |
switch ($column) | |
{ | |
case "slide_link_url": | |
echo '<a href="'.$custom["link_url"][0].'" >Visit URL</a>'; | |
break; | |
case "slide_featured_image": | |
echo the_post_thumbnail('thumbnail'); | |
break; | |
} | |
} | |
/** | |
* Partnerships | |
*/ | |
function partner_edit_columns($columns){ | |
$columns = array( | |
"cb" => "<input type=\"checkbox\" />", | |
"title" => "Partner Name", | |
"partner_featured_image" => "Image", | |
"partner_link_url" => "Link To", | |
//"catalog" => "Catalog", | |
); | |
return $columns; | |
} | |
function partner_custom_columns($column){ | |
global $post; | |
$custom = get_post_custom(); | |
switch ($column) | |
{ | |
case "partner_link_url": | |
echo '<a href="'.$custom["link_url"][0].'" >Visit URL</a>'; | |
break; | |
case "partner_featured_image": | |
echo the_post_thumbnail('thumbnail'); | |
break; | |
} | |
} | |
/** | |
* Events | |
*/ | |
function events_edit_columns($columns){ | |
$columns = array( | |
"cb" => "<input type=\"checkbox\" />", | |
"title" => "Events Name", | |
"event_description" => "Description", | |
"event_link_url" => "Link To", | |
"event_starting_date_month" => "Starts Month", | |
"event_ending_date" => "Ends On", | |
); | |
return $columns; | |
} | |
function events_custom_columns($column){ | |
global $post; | |
$custom = get_post_custom(); | |
$months= array('January','February','April','May','June','July','Agust','October','September','November','Dicember' ); | |
switch ($column) | |
{ | |
case "event_description": | |
the_excerpt(); | |
break; | |
case "event_link_url": | |
echo '<a href="'.$custom["link_url"][0].'" >Visit URL</a>'; | |
break; | |
case "event_starting_date_month": | |
echo $months[$custom["starting_date_month"][0]].', '.$custom["starting_date_day"][0].', '.$custom["starting_date_year"][0]; | |
break; | |
case "event_ending_date": | |
echo $months[$custom["ending_date_month"][0]].', '.$custom["ending_date_day"][0].', '.$custom["ending_date_year"][0]; | |
break; | |
} | |
} | |
/** | |
* Campaings | |
*/ | |
function campaings_edit_columns($columns){ | |
$columns = array( | |
"cb" => "<input type=\"checkbox\" />", | |
"title" => "Events Name", | |
"campaing_description" => "Description", | |
"campaing_link_url" => "Link To", | |
"campaing_starting_date_month" => "Starts Month", | |
"campaing_ending_date" => "Ends On", | |
); | |
return $columns; | |
} | |
function campaings_custom_columns($column){ | |
global $post; | |
$custom = get_post_custom(); | |
$months= array('January','February','April','May','June','July','Agust','October','September','November','Dicember' ); | |
switch ($column) | |
{ | |
case "campaing_description": | |
the_excerpt(); | |
break; | |
case "campaing_link_url": | |
echo '<a href="'.$custom["link_url"][0].'" >Visit URL</a>'; | |
break; | |
case "campaing_starting_date_month": | |
echo $months[$custom["starting_date_month"][0]].', '.$custom["starting_date_day"][0].', '.$custom["starting_date_year"][0]; | |
break; | |
case "campaing_ending_date": | |
echo $months[$custom["ending_date_month"][0]].', '.$custom["ending_date_day"][0].', '.$custom["ending_date_year"][0]; | |
break; | |
} | |
} | |
/** | |
* Members | |
*/ | |
function members_edit_columns($columns){ | |
$columns = array( | |
"cb" => "<input type=\"checkbox\" />", | |
"title" => "Member Name", | |
"member_description" => "Description", | |
"memeber_featured_image" => "Picture", | |
"member_link_url" => "Link To", | |
); | |
return $columns; | |
} | |
function members_custom_columns($column){ | |
global $post; | |
$custom = get_post_custom(); | |
switch ($column) | |
{ | |
case "member_description": | |
the_excerpt(); | |
break; | |
case "memeber_featured_image": | |
echo the_post_thumbnail('thumbnail'); | |
break; | |
case "member_link_url": | |
echo '<a href="'.$custom["link_url"][0].'" >Visit URL</a>'; | |
break; | |
} | |
} | |
// -------------------------------------------- | |
/** | |
* Hadron Methods To Print on Front | |
* @since Hadron 1.0 | |
*/ | |
function custom_posts_on_front($by_page = 5, $paged =1,$post_type){ | |
$args = array( 'posts_per_page' => 5, | |
'offset' => 0, | |
'orderby' => 'post_date', | |
'order' => 'DESC', | |
'post_type' => $post_type, | |
'paged' => 1, | |
'post_status' => 'publish', | |
'suppress_filters' => true ); | |
$the_query = query_posts( $args); | |
if ($the_query){ | |
echo '<div class="row">'; | |
foreach ( $the_query as $post ) { | |
?> | |
<div class="col-3"> | |
<?php echo $post->post_title; ?> | |
<?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?> | |
</div> | |
<?php | |
} | |
echo '</div>'; | |
} | |
wp_reset_postdata(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment