Skip to content

Instantly share code, notes, and snippets.

/bizlight excerpt
Created Mar 15, 2017

Embed
What would you like to do?
function bizlight_home_service_array( ){
$bizlight_home_service_contents_array = array();
$bizlight_home_service_contents_array[0]['bizlight-home-service-title'] = __('LOVELY DESIGN', 'bizlight');
$bizlight_home_service_contents_array[0]['bizlight-home-service-content'] = __("The set doesn't moved. Deep don't fru it fowl gathering heaven days moving creeping under from i air. Set it fifth Meat was darkness. every bring in it.", 'bizlight');
$bizlight_home_service_contents_array[0]['bizlight-home-service-link'] = '#';
$bizlight_home_service_contents_array[0]['bizlight-home-service-icon'] = 'fa-desktop';
$bizlight_home_service_contents_array[1]['bizlight-home-service-title'] = __('STYLIES PHOTOGRAPY', 'bizlight');
$bizlight_home_service_contents_array[1]['bizlight-home-service-content'] = __("The set doesn't moved. Deep don't fru it fowl gathering heaven days moving creeping under from i air. Set it fifth Meat was darkness. every bring in it.", 'bizlight');
$bizlight_home_service_contents_array[1]['bizlight-home-service-link'] = '#';
$bizlight_home_service_contents_array[1]['bizlight-home-service-icon'] = 'fa-camera-retro';
$bizlight_home_service_contents_array[2]['bizlight-home-service-title'] = __('CREATIVE AGENCY', 'bizlight');
$bizlight_home_service_contents_array[2]['bizlight-home-service-content'] = __("The set doesn't moved. Deep don't fru it fowl gathering heaven days moving creeping under from i air. Set it fifth Meat was darkness. every bring in it.", 'bizlight');
$bizlight_home_service_contents_array[2]['bizlight-home-service-link'] = '#';
$bizlight_home_service_contents_array[2]['bizlight-home-service-icon'] = 'fa-rocket';
$bizlight_icons_arrays = array();
$bizlight_home_service_args = array();
$repeated = array('bizlight-home-service-page-icon','bizlight-home-service-pages-ids');
$bizlight_home_service_posts = bizlight_get_repeated_all_value(3, $repeated);
$bizlight_home_service_posts_ids = array();
if( null != $bizlight_home_service_posts ) {
foreach( $bizlight_home_service_posts as $bizlight_home_service_post ) {
if( isset($bizlight_home_service_post['bizlight-home-service-pages-ids']) && 0 != $bizlight_home_service_post['bizlight-home-service-pages-ids'] ){
$bizlight_home_service_posts_ids[] = $bizlight_home_service_post['bizlight-home-service-pages-ids'];
if( isset( $bizlight_home_service_post['bizlight-home-service-page-icon'] )){
$bizlight_home_service_page_icon = $bizlight_home_service_post['bizlight-home-service-page-icon'];
}
else{
$bizlight_home_service_page_icon =' fa-desktop';
}
$bizlight_icons_arrays[] = $bizlight_home_service_page_icon;
}
}
if( !empty( $bizlight_home_service_posts_ids )){
$bizlight_home_service_args = array(
'post_type' => 'page',
'post__in' => $bizlight_home_service_posts_ids,
'posts_per_page' => 3,
'orderby' => 'post__in'
);
}
}
// the query
if( !empty( $bizlight_home_service_args )){
$bizlight_home_service_contents_array = array(); /*again empty array*/
$bizlight_home_service_post_query = new WP_Query( $bizlight_home_service_args );
if ( $bizlight_home_service_post_query->have_posts() ) :
$i = 0;
while ( $bizlight_home_service_post_query->have_posts() ) : $bizlight_home_service_post_query->the_post();
$bizlight_home_service_contents_array[$i]['bizlight-home-service-title'] = get_the_title();
$bizlight_home_service_contents_array[$i]['bizlight-home-service-content'] = get_the_excerpt();
$bizlight_home_service_contents_array[$i]['bizlight-home-service-link'] = get_permalink();
if(isset( $bizlight_icons_arrays[$i] )){
$bizlight_home_service_contents_array[$i]['bizlight-home-service-icon'] = $bizlight_icons_arrays[$i];
}
else{
$bizlight_home_service_contents_array[$i]['bizlight-home-service-icon'] = 'fa-desktop';
}
$i++;
endwhile;
wp_reset_postdata();
endif;
}
return $bizlight_home_service_contents_array;
}
function my_add_excerpts_to_pages() {
add_post_type_support('page', 'excerpt');
}
add_action('init', 'my_add_excerpts_to_pages');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.