...........................................................................................................................................................................................................................................................................................................................@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%PDF-1.5 MRK IS HERE %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 65.108.66.160 / Your IP : 216.73.217.50 Web Server : Apache System : Linux srv16.asso.com.ar 4.18.0-553.123.1.el8_10.x86_64 #1 SMP Tue May 5 04:00:43 EDT 2026 x86_64 User : alasaweborg ( 1047) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/alasaweborg/public_html/wp-content/themes/greenture/includes/ |
Upload File : |
<?php
/**
* Theme Functions
*/
/* =========================================================
* Header Content Area
* ========================================================= */
if ( ! function_exists( 'greenture_header_content_area' ) ) {
function greenture_header_content_area( $section ) {
$menu_name = '';
if( $section == 'social-links' ) {
echo '<div id="header-sidebar-social" class="header-sidebar-social">';
greenture_display_social_icons();
echo '</div>';
}
if( $section == 'top-navigation') {
echo '<div class="hidden-xs">';
echo wp_nav_menu( array( 'container_class' => 'tpath-top-nav top-menu-navigation', 'container_id' => 'top-nav', 'menu_id' => 'top-menu', 'menu_class' => 'nav navbar-nav navbar-right tpath-top-nav', 'theme_location' => 'top-menu', 'fallback_cb' => 'wp_bootstrap_navwalker::fallback', 'walker' => new wp_bootstrap_navwalker() ) );
echo '</div>';
// ==================== Mobile Menu ==================== //
echo '<div id="mobile-menu" class="visible-xs">';
echo wp_nav_menu( array( 'container_class' => 'tpath-top-nav top-menu-navigation', 'container_id' => 'top-mobile-nav', 'menu_id' => 'top-mobile-menu', 'menu_class' => 'nav navbar-nav tpath-top-nav', 'theme_location' => 'top-menu', 'fallback_cb' => 'wp_bootstrap_mobile_navwalker::fallback', 'walker' => new wp_bootstrap_mobile_navwalker() ) );
echo '</div>';
}
if( $section == 'main-navigation' ) {
if( $section == 'main-navigation' ) {
$menu_name = 'primary-menu';
$tmenu_id = 'nav';
}
echo '<div class="hidden-xs">';
if( greenture_get_option( 'menu_type' ) != 'standard' && greenture_get_option( 'menu_type' ) == 'megamenu' ) {
echo wp_nav_menu( array( 'container_class' => 'main-nav main-megamenu-navigation', 'container_id' => 'main-mega-'.$tmenu_id.'', 'menu_id' => 'main-mega-menu-'.$tmenu_id.'', 'menu_class' => 'nav navbar-nav navbar-main tpath-main-nav', 'theme_location' => $menu_name, 'fallback_cb' => 'GreentureMegaMenuFrontendWalker::fallback', 'walker' => new GreentureMegaMenuFrontendWalker() ) );
} else {
echo wp_nav_menu( array( 'container_class' => 'main-nav main-menu-navigation', 'container_id' => 'main-'.$tmenu_id.'', 'menu_id' => 'main-menu-'.$tmenu_id.'', 'menu_class' => 'nav navbar-nav navbar-main tpath-main-nav', 'theme_location' => $menu_name, 'fallback_cb' => 'wp_bootstrap_navwalker::fallback', 'walker' => new wp_bootstrap_navwalker() ) );
}
echo '</div>';
// ==================== Mobile Menu ==================== //
echo '<div id="mobile-menu'.$tmenu_id.'" class="visible-xs">';
echo wp_nav_menu( array( 'container_class' => 'main-nav main-menu-navigation', 'container_id' => 'main-mobile-'.$tmenu_id.'', 'menu_id' => 'main-mobile-menu-'.$tmenu_id.'', 'menu_class' => 'nav navbar-nav navbar-main tpath-main-nav', 'theme_location' => $menu_name, 'fallback_cb' => 'wp_bootstrap_mobile_navwalker::fallback', 'walker' => new wp_bootstrap_mobile_navwalker() ) );
echo '</div>';
}
if( $section == 'search-box') {
echo '<div id="header-search-form" class="header-search-form">';
echo '<i class="ionicons ion-ios-search btn-trigger"></i>';
echo get_search_form();
echo '</div>';
}
}
}
/* =========================================================
* Main Layout Custom Classes
* ========================================================= */
/**
* Primary Content Classes works on all column layouts
*/
if ( ! function_exists( 'greenture_primary_content_classes' ) ) {
function greenture_primary_content_classes() {
$post = greenture_get_global_var( 'post' );
$layout = '';
if( is_singular() ) {
$layout = get_post_meta( $post->ID, 'greenture_layout', true );
}
if( is_archive() ) {
$layout = greenture_get_option( 'blog_archive_layout' );
}
if( is_home() ) {
$home_id = get_option( 'page_for_posts' );
$layout = get_post_meta( $home_id, 'greenture_layout', true );
if( !$layout ) {
$layout = greenture_get_option( 'blog_layout' );
}
}
if( is_singular('greenture_portfolio') ) {
$layout = greenture_get_option( 'layout' );
}
else if( is_singular( 'post' ) ) {
$layout = get_post_meta( $post->ID, 'greenture_layout', true );
if( !$layout ) {
$layout = greenture_get_option( 'single_post_layout' );
}
}
if( !$layout ) {
if( greenture_get_option( 'layout' ) != '' ) {
$layout = greenture_get_option( 'layout' );
}
else {
$layout = 'two-col-right';
}
}
if( $layout == 'two-col-left' || $layout == 'two-col-right' ) {
echo 'content-col-small';
}
elseif( $layout == 'one-col' ) {
echo 'content-col-full';
}
}
}
/**
* Footer Widget Classes based on columns
*/
if ( ! function_exists( 'greenture_footer_widget_classes' ) ) {
function greenture_footer_widget_classes( $columns ) {
$footer_layout_style = greenture_get_option( 'footer_layout_style' );
if( !$columns && greenture_get_option( 'footer_widgets_enable' ) ) {
$columns = greenture_get_option( 'footer_widget_layout' );
}
if( isset( $footer_layout_style ) && $footer_layout_style == 'two-column' ) {
if( $columns == 1 ) {
echo 'col-xs-12';
} elseif( $columns == 2 ) {
echo 'col-sm-6';
} elseif( $columns == 3 ) {
echo 'col-md-4 col-sm-12';
} elseif( $columns == 4 ) {
echo 'col-md-3 col-sm-12';
}
} else {
if( $columns == 1 ) {
echo 'col-xs-12';
} elseif( $columns == 2 ) {
echo 'col-sm-6';
} elseif( $columns == 3 ) {
echo 'col-sm-4';
} elseif( $columns == 4 ) {
echo 'col-sm-3';
}
}
}
}
/* =========================================================
* Display Social Icons no Footer
* ========================================================= */
if ( ! function_exists( 'greenture_display_social_icons' ) ) {
function greenture_display_social_icons( $type = '' ) {
$zo_tooltip = '';
if( $type == '' ) {
$type = greenture_get_option( 'social_icon_type' );
}
if( $type == "transparent" ) {
$zo_tooltip = 1;
}
else {
$zo_tooltip = 0;
}
echo '<ul class="tpath-social-icons soc-icon-'.$type.'">';
$facebook_link = greenture_get_option( 'facebook_link' );
if( $facebook_link && $zo_tooltip != 1 ) {
echo '<li class="facebook"><a target="_blank" href="'.esc_url( $facebook_link ).'"><i class="ionicons ion-social-facebook"></i></a></li>';
}
elseif( $facebook_link ) {
echo '<li class="facebook"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Facebook" target="_blank" href="'.esc_url( $facebook_link ).'"><i class="ionicons ion-social-facebook"></i></a></li>';
}
$twitter_link = greenture_get_option( 'twitter_link' );
if( $twitter_link && $zo_tooltip != 1 ) {
echo '<li class="twitter"><a target="_blank" href="'.esc_url( $twitter_link ).'"><i class="ionicons ion-social-twitter"></i></a></li>';
}
elseif( $twitter_link ) {
echo '<li class="twitter"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Twitter" target="_blank" href="'.esc_url( $twitter_link ).'"><i class="ionicons ion-social-twitter"></i></a></li>';
}
$dribbble_link = greenture_get_option( 'dribbble_link' );
if( $dribbble_link && $zo_tooltip != 1 ) {
echo '<li class="dribbble"><a target="_blank" href="'.esc_url( $dribbble_link ).'"><i class="ionicons ion-social-dribbble-outline"></i></a></li>';
}
elseif( $dribbble_link ) {
echo '<li class="dribbble"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Dribbble" target="_blank" href="'.esc_url( $dribbble_link ).'"><i class="ionicons ion-social-dribbble-outline"></i></a></li>';
}
$linkedin_link = greenture_get_option( 'linkedin_link' );
if( $linkedin_link && $zo_tooltip != 1 ) {
echo '<li class="linkedin"><a target="_blank" href="'.esc_url( $linkedin_link ).'"><i class="fa fa-linkedin"></i></a></li>';
}
elseif( $linkedin_link ) {
echo '<li class="linkedin"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="LinkedIn" target="_blank" href="'.esc_url( $linkedin_link ).'"><i class="fa fa-linkedin"></i></a></li>';
}
$pinterest_link = greenture_get_option( 'pinterest_link' );
if( $pinterest_link && $zo_tooltip != 1 ) {
echo '<li class="pinterest"><a target="_blank" href="'.esc_url( $pinterest_link ).'"><i class="ionicons ion-social-pinterest"></i></a></li>';
}
elseif( $pinterest_link ) {
echo '<li class="pinterest"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Pinterest" target="_blank" href="'.esc_url( $pinterest_link ).'"><i class="ionicons ion-social-pinterest"></i></a></li>';
}
$vimeo_link = greenture_get_option( 'vimeo_link' );
if( $vimeo_link && $zo_tooltip != 1 ) {
echo '<li class="vimeo"><a target="_blank" href="'.esc_url( $vimeo_link ).'"><i class="ionicons ion-social-vimeo"></i></a></li>';
}
elseif( $vimeo_link ) {
echo '<li class="googleplus"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Vimeo" target="_blank" href="'.esc_url( $vimeo_link ).'"><i class="ionicons ion-social-vimeo"></i></a></li>';
}
$googleplus_link = greenture_get_option( 'googleplus_link' );
if( $googleplus_link && $zo_tooltip != 1 ) {
echo '<li class="googleplus"><a target="_blank" href="'.esc_url( $googleplus_link ).'"><i class="ionicons ion-social-googleplus"></i></a></li>';
}
elseif( $googleplus_link ) {
echo '<li class="googleplus"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Google Plus" target="_blank" href="'.esc_url( $googleplus_link ).'"><i class="ionicons ion-social-googleplus"></i></a></li>';
}
$youtube_link = greenture_get_option( 'youtube_link' );
if( $youtube_link && $zo_tooltip != 1 ) {
echo '<li class="youtube"><a target="_blank" href="'.esc_url( $youtube_link ).'"><i class="ionicons ion-social-youtube"></i></a></li>';
}
elseif( $youtube_link ) {
echo '<li class="youtube"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="You Tube" target="_blank" href="'.esc_url( $youtube_link ).'"><i class="ionicons ion-social-youtube"></i></a></li>';
}
$rss_link = greenture_get_option( 'rss_link' );
if( $rss_link && $zo_tooltip != 1 ) {
echo '<li class="rss"><a target="_blank" href="'.esc_url( $rss_link ).'"><i class="ionicons ion-social-rss"></i></a></li>';
}
elseif( $rss_link ) {
echo '<li class="rss"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="RSS" target="_blank" href="'.esc_url( $rss_link ).'"><i class="ionicons ion-social-rss"></i></a></li>';
}
$tumblr_link = greenture_get_option( 'tumblr_link' );
if( $tumblr_link && $zo_tooltip != 1 ) {
echo '<li class="tumblr"><a target="_blank" href="'.esc_url( $tumblr_link ).'"><i class="ionicons ion-social-tumblr"></i></a></li>';
}
elseif( $tumblr_link ) {
echo '<li class="tumblr"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Tumblr" target="_blank" href="'.esc_url( $tumblr_link ).'"><i class="ionicons ion-social-tumblr"></i></a></li>';
}
$reddit_link = greenture_get_option( 'reddit_link' );
if( $reddit_link && $zo_tooltip != 1 ) {
echo '<li class="reddit"><a target="_blank" href="'.esc_url( $reddit_link ).'"><i class="ionicons ion-social-reddit"></i></a></li>';
}
elseif( $reddit_link ) {
echo '<li class="reddit"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Reddit" target="_blank" href="'.esc_url( $reddit_link ).'"><i class="ionicons ion-social-reddit"></i></a></li>';
}
$digg_link = greenture_get_option( 'digg_link' );
if( $digg_link && $zo_tooltip != 1 ) {
echo '<li class="digg"><a target="_blank" href="'.esc_url( $digg_link ).'"><i class="fa fa-digg"></i></a></li>';
}
elseif( $digg_link ) {
echo '<li class="digg"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Digg" target="_blank" href="'.esc_url( $digg_link ).'"><i class="fa fa-digg"></i></a></li>';
}
$flickr_link = greenture_get_option( 'flickr_link' );
if( $flickr_link && $zo_tooltip != 1 ) {
echo '<li class="flickr"><a target="_blank" href="'.esc_url( $flickr_link ).'"><i class="fa fa-flickr"></i></a></li>';
}
elseif( $flickr_link ) {
echo '<li class="flickr"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Flickr" target="_blank" href="'.esc_url( $flickr_link ).'"><i class="fa fa-flickr"></i></a></li>';
}
$instagram_link = greenture_get_option( 'instagram_link' );
if( $instagram_link && $zo_tooltip != 1 ) {
echo '<li class="instagram"><a target="_blank" href="'.esc_url( $instagram_link ).'"><i class="ionicons ion-social-instagram-outline"></i></a></li>';
}
elseif( $instagram_link ) {
echo '<li class="instagram"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Instagram" target="_blank" href="'.esc_url( $instagram_link ).'"><i class="ionicons ion-social-instagram-outline"></i></a></li>';
}
$skype_link = greenture_get_option( 'skype_link' );
if( $skype_link && $zo_tooltip != 1 ) {
echo '<li class="skype"><a target="_blank" href="'.esc_url( $skype_link ).'"><i class="ionicons ion-social-skype"></i></a></li>';
}
elseif( $skype_link ) {
echo '<li class="skype"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Skype" target="_blank" href="'.esc_url( $skype_link ).'"><i class="ionicons ion-social-skype"></i></a></li>';
}
$yahoo_link = greenture_get_option( 'yahoo_link' );
if( $yahoo_link && $zo_tooltip != 1 ) {
echo '<li class="yahoo"><a target="_blank" href="'.esc_url( $yahoo_link ).'"><i class="ionicons ion-social-yahoo"></i></a></li>';
}
elseif( $yahoo_link ) {
echo '<li class="yahoo"><a class="zo-tooltip" data-placement="top" data-toggle="tooltip" data-original-title="Yahoo" target="_blank" href="'.esc_url( $yahoo_link ).'"><i class="ionicons ion-social-yahoo"></i></a></li>';
}
echo '</ul>';
}
}
/* =========================================================
* Get Post Gallery Images in Slider
* ========================================================= */
function greenture_get_gallery_post_images($size, $id) {
if( !$size )
$size = 'full';
$output = '';
if($images = get_posts(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1, // show all
'post_status' => null,
'post_mime_type' => 'image',
'orderby' => 'title',
'order' => 'ASC',
))) {
foreach($images as $image) {
$posts_image = wp_get_attachment_image($image->ID,$size);
$posts_image_link = wp_get_attachment_image_src($image->ID, 'full');
$output .= '<div class="blog-gallery-item"><a href="'.esc_url( $posts_image_link[0] ).'" data-rel="prettyPhoto[gallery'.esc_attr( $id ).']" >' . $posts_image . '</a></div>';
}
}
return $output;
}
/* =========================================================
* Display Social Sharing Icons in Blog Posts
* ========================================================= */
if ( ! function_exists( 'greenture_display_social_sharing_icons' ) ) {
function greenture_display_social_sharing_icons() {
$sharing_icons = '';
$post = greenture_get_global_var( 'post' );
$sharing_icons .= '<div class="tpath-social-share-box"><ul class="tpath-social-share-icons share-box">';
if( greenture_get_option( 'sharing_facebook' ) ) {
$sharing_icons .= '<li class="facebook"><a target="_blank" href="http://www.facebook.com/sharer/sharer.php?u='.urlencode(get_permalink()).'" title="facebook"><i class="fa fa-facebook"></i></a></li>';
}
if( greenture_get_option( 'sharing_twitter' ) ) {
$sharing_icons .= '<li class="twitter"><a target="_blank" href="https://twitter.com/home?status='.urlencode($post->post_title). '%20-%20' . urlencode(get_permalink()).'" title="twitter"><i class="fa fa-twitter"></i></a></li>';
}
if( greenture_get_option( 'sharing_linkedin' ) ) {
$sharing_icons .= '<li class="linkedin"><a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url='.urlencode(get_permalink()).'&title='.urlencode(get_the_title()).'"><i class="fa fa-linkedin"></i></a></li>';
}
if( greenture_get_option( 'sharing_pinterest' ) ) {
$share_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'greenture-blog-large');
$sharing_icons .= '<li class="pinterest"><a target="_blank" href="http://pinterest.com/pin/create/button/?url='.urlencode(get_permalink()).'&description='.urlencode($post->post_title).'&media='.urlencode($share_image[0]).'"><i class="fa fa-pinterest"></i></a></li>';
}
if( greenture_get_option( 'sharing_googleplus' ) ) {
$sharing_icons .= '<li class="googleplus"><a target="_blank" href="https://plus.google.com/share?url='.urlencode(get_permalink()).'"><i class="fa fa-google-plus"></i></a></li>';
}
if( greenture_get_option( 'sharing_tumblr' ) ) {
if( has_post_format('quote') ) {
$sharing_icons .= '<li class="tumblr"><a target="_blank" href="http://www.tumblr.com/share/quote?quote='.urlencode(get_the_content()).'&source='.urlencode($post->post_title).'"><i class="fa fa-tumblr"></i></a></li>';
}
else {
$sharing_icons .= '<li class="tumblr"><a target="_blank" href="http://www.tumblr.com/share/link?url='.urlencode(get_permalink()).'&name='.urlencode($post->post_title).'&description='.urlencode(get_the_excerpt()).'"><i class="fa fa-tumblr"></i></a></li>';
}
}
if( greenture_get_option( 'sharing_reddit' ) ) {
$sharing_icons .= '<li class="reddit"><a target="_blank" href="http://reddit.com/submit?url='.urlencode(get_permalink()).'&title='.urlencode(get_the_title()).'"><i class="fa fa-reddit"></i></a></li>';
}
if( greenture_get_option( 'sharing_digg' ) ) {
$sharing_icons .= '<li class="digg"><a target="_blank" href="http://digg.com/submit?url='.urlencode(get_permalink()).'&title='.urlencode(get_the_title()).'"><i class="fa fa-digg"></i></a></li>';
}
if( greenture_get_option( 'sharing_email' ) ) {
$sharing_icons .= '<li class="email"><a target="_blank" href="mailto:?subject='.urlencode(get_the_title()).'&body='.urlencode(get_permalink()).'"><i class="fa fa-envelope"></i></a></li>';
}
$sharing_icons .= '</ul></div>';
return $sharing_icons;
}
}
/* =========================================================
* Display Pagination on Archive/Category and Index Pages
* ========================================================= */
if ( ! function_exists( 'greenture_pagination' ) ) {
function greenture_pagination( $pages = '', $scroll = '' ) {
$wp_query = greenture_get_global_var( 'wp_query' );
$wp_rewrite = greenture_get_global_var( 'wp_rewrite' );
$output = '';
$extra_class = '';
if( $scroll == "infinite" ) {
$extra_class = ' infinite-scroll';
} else {
$extra_class = ' scroll-pagination';
}
$pages = ($pages) ? $pages : $wp_query->max_num_pages;
// Don't print empty markup if there's only one page.
if ( $pages < 2 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = esc_url( remove_query_arg( array_keys( $query_args ), $pagenum_link ) );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
// Arrows with RTL support
$isRTL = 0;
if( is_rtl() || isset( $_GET['RTL'] ) ) {
$isRTL = 1;
}
$prev_arrow = $isRTL ? 'fa fa-angle-right' : 'fa fa-angle-left';
$next_arrow = $isRTL ? 'fa fa-angle-left' : 'fa fa-angle-right';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $pages,
'current' => $paged,
'show_all' => false,
'mid_size' => 3,
'type' => 'array',
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => esc_html__( 'PREV', 'greenture' ),
'next_text' => esc_html__( 'NEXT', 'greenture' ),
) );
if ( !empty($links) ) {
$output .= '<ul class="pagination' . esc_attr( $extra_class ) . '">';
foreach( $links as $link ) {
$output .= '<li>'. $link .'</li>';
}
$output .= '</ul>';
}
return $output;
}
}
/* =========================================================
* Display Post Navigation on Single Posts
* ========================================================= */
if( ! function_exists( 'greenture_postnavigation' ) ) {
function greenture_postnavigation() {
if ( is_single() ) {
?>
<div class="post-navigation">
<ul class="pager">
<li class="previous"><?php previous_post_link( '%link', '<i class="fa fa-angle-left"></i> %title' ) ?></li>
<li class="next"><?php next_post_link( '%link', '%title <i class="fa fa-angle-right"></i>' ) ?></li>
</ul>
</div>
<?php
}
}
}
/* =========================================================
* Display Comments in different Layout
* ========================================================= */
if( ! function_exists( "greenture_custom_comments" ) ) {
function greenture_custom_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
<div id="li-comment-<?php comment_ID() ?>" class="comment-container">
<div class="comment-avatar">
<?php echo get_avatar($comment, $args['avatar_size']); ?>
</div>
<div class="comments-box-container">
<div class="comments-box">
<div class="comment-list meta">
<h6 class="author-name"><?php echo get_comment_author_link(); ?></h6>
<div class="comment-post-meta">
<span class="edit"><?php edit_comment_link( esc_html__('Edit', 'greenture'), '', ''); ?></span>
<span class="reply"><?php comment_reply_link(array_merge( $args, array('reply_text' => esc_html__('Reply', 'greenture'), 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?></span>
</div>
<div class="comment-posted-date">
<?php printf( wp_kses(__('<span>%1$s</span> at %2$s', 'greenture'), greenture_wp_allowed_tags() ), get_comment_date(), get_comment_time() ); ?>
</div>
</div>
</div><!-- .comments-box -->
<div class="comment-status-text" id="comment-<?php comment_ID(); ?>">
<?php comment_text() ?>
<?php if ($comment->comment_approved == '0') { ?>
<p class='comment-unapproved'><?php esc_html_e('Your comment is awaiting moderation.', 'greenture'); ?></p>
<?php } ?>
</div><!-- .comment-status-text -->
</div>
</div><!-- .comment-container -->
<?php
}
}
/* =========================================================
* Display Author Info on Single Post pages
* ========================================================= */
if( ! function_exists( "greenture_author_info" ) ) {
function greenture_author_info() {
$social_output = '';
$facebook_profile = get_the_author_meta( 'facebook_profile' );
if( isset($facebook_profile) && $facebook_profile != '' ) {
$social_output .= '<li class="facebook"><a href="' . esc_url($facebook_profile) . '" target="_blank"><i class="fa fa-facebook"></i></a></li>';
}
$twitter_profile = get_the_author_meta( 'twitter_profile' );
if( isset($twitter_profile) && $twitter_profile != '' ) {
$social_output .= '<li class="twitter"><a href="' . esc_url($twitter_profile) . '" target="_blank"><i class="fa fa-twitter"></i></a></li>';
}
$linkedin_profile = get_the_author_meta( 'linkedin_profile' );
if( isset($linkedin_profile) && $linkedin_profile != '' ) {
$social_output .= '<li class="linkedin"><a href="' . esc_url($linkedin_profile) . '" target="_blank"><i class="fa fa-linkedin"></i></a></li>';
}
$google_profile = get_the_author_meta( 'google_profile' );
if( isset($google_profile) && $google_profile != '' ) {
$social_output .= '<li class="googleplus"><a href="' . esc_url($google_profile) . '" target="_blank"><i class="fa fa-google-plus"></i></a></li>';
}
$pinterest_profile = get_the_author_meta( 'pinterest_profile' );
if( isset($pinterest_profile) && $pinterest_profile != '' ) {
$social_output .= '<li class="pinterest"><a href="' . esc_url($pinterest_profile) . '" target="_blank"><i class="fa fa-pinterest"></i></a></li>';
}
$mail = get_the_author_meta('email');
if( isset($mail) && $mail != '' ) {
$social_output .= '<li class="email"><a href="mailto:' . esc_url($mail). '" rel="author" target="_blank"><i class="fa fa-envelope"></i></a></li>';
}
$posting = get_the_author_meta('posting');
$company_name = get_the_author_meta('company_name');
$author_id = get_the_author_meta('ID');
$author_name = get_the_author_meta('display_name', $author_id);
$author_description = get_the_author_meta('description', $author_id);
if( is_author() ) { ?>
<div class="author-info author-info-page clearfix">
<div class="author-avatar">
<?php echo get_avatar(get_the_author_meta('email', $author_id), '80'); ?>
</div>
<div class="author-info-container">
<div class="author-links">
<h5 class="author-name"><?php echo esc_html( $author_name ); ?></h5>
<span class="blog-posts-count"><?php echo count_user_posts( $author_id ); ?> <?php echo esc_html__( 'Blogposts', 'greenture' ); ?></span>
<?php if( isset( $posting ) && $posting != '' ) { ?>
<span class="posting"><?php echo esc_html( $posting ); ?></span>
<?php } ?>
<?php if( isset( $company_name ) && $company_name != '' ) { ?>
<span class="company-name"><?php echo esc_html( $company_name ); ?></span>
<?php } ?>
</div>
<div class="author-description">
<p><?php if( ! $author_description ) {
echo sprintf( esc_html__( 'This author %s has created %s entries.', 'greenture' ), $author_name, count_user_posts( $author_id ) );
} else {
echo esc_html( $author_description );
} ?></p>
</div>
<div class="author-media-links tpath-social-share-box pull-right">
<ul class="author-social tpath-social-share-icons clearfix">
<?php echo wp_kses( $social_output, greenture_wp_allowed_tags() ); ?>
</ul>
</div>
</div>
</div>
<?php } else {
if( isset( $author_description ) && $author_description != '' ) { ?>
<div class="author-info clearfix">
<div class="author-avatar">
<?php echo get_avatar(get_the_author_meta('email'), '85'); ?>
</div>
<div class="author-info-container">
<div class="author-links">
<h5 class="author-name"><?php echo esc_html( $author_name ); ?></h5>
<span class="blog-posts-count"><?php echo count_user_posts( $author_id ); ?> <?php echo esc_html__( 'Blogposts', 'greenture' ); ?></span>
<?php if( isset( $posting ) && $posting != '' ) { ?>
<span class="posting"><?php echo esc_html( $posting ); ?></span>
<?php } ?>
<?php if( isset( $company_name ) && $company_name != '' ) { ?>
<span class="company-name"><?php echo esc_html( $company_name ); ?></span>
<?php } ?>
</div>
<div class="author-description">
<p><?php the_author_meta("description"); ?></p>
</div>
<div class="author-media-links tpath-social-share-box pull-right">
<ul class="author-social tpath-social-share-icons clearfix">
<?php echo wp_kses( $social_output, greenture_wp_allowed_tags() ); ?>
</ul>
</div>
</div>
</div>
<?php }
}
}
}
/* =========================================================
* Register Additional Image field For Post Categories
* ========================================================= */
if ( ! function_exists( 'greenture_category_taxonomy_add_meta_fields' ) ) {
function greenture_category_taxonomy_add_meta_fields() { ?>
<div class="form-field">
<label for="greenture_cat_thumbnail_image"><?php esc_html_e( 'Category Image', 'greenture' ); ?></label>
<div class="tpath_cat_img_field">
<input type="hidden" class="blogpress_cat_data" data-title="<?php esc_html_e( 'Select image', 'greenture' ); ?>" data-text="<?php esc_html_e( 'Upload image', 'greenture' ); ?>" />
<input type="text" class="media_field" id="greenture_cat_thumbnail_image" name="greenture_cat_thumbnail_image" value="" />
<button type="button" class="tpath_img_upload_button btn"><?php esc_html_e( 'Upload/Add image', 'greenture' ); ?></button>
<button type="button" class="tpath_img_remove_button btn"><?php esc_html_e( 'Remove image', 'greenture' ); ?></button>
</div>
<p class="description"><?php esc_html_e( 'Select an image to list categories with images', 'greenture' ); ?></p>
<?php wp_enqueue_media(); ?>
</div>
<?php
}
}
add_action( 'category_add_form_fields', 'greenture_category_taxonomy_add_meta_fields', 10, 2 );
if ( ! function_exists( 'greenture_category_taxonomy_edit_meta_fields' ) ) {
function greenture_category_taxonomy_edit_meta_fields($term) {
// put the term ID into a variable
$term_id = $term->term_id;
// retrieve the existing value(s) for this meta field. This returns an array
$term_meta = get_option( "taxonomy_$term_id" ); ?>
<tr class="form-field">
<th scope="row" valign="top"><label for="greenture_cat_thumbnail_image"><?php esc_html_e( 'Category Image', 'greenture' ); ?></label></th>
<td>
<div class="tpath_cat_img_field">
<input type="text" class="media_field" id="greenture_cat_thumbnail_image" name="greenture_cat_thumbnail_image" value="<?php echo esc_url($term_meta['greenture_thumbnail_image']); ?>" />
<button type="button" class="tpath_img_upload_button btn"><?php esc_html_e( 'Upload/Add image', 'greenture' ); ?></button>
<button type="button" class="tpath_img_remove_button btn"><?php esc_html_e( 'Remove image', 'greenture' ); ?></button>
</div>
<p class="description"><?php esc_html_e( 'Select an image to list categories with images', 'greenture' ); ?></p>
<?php wp_enqueue_media(); ?>
<script type="text/javascript">
// Only show remove button when needed
if ( ! jQuery('#greenture_cat_thumbnail_image').val() ) {
jQuery('.tpath_img_remove_button').hide();
}
// Uploading files
var file_frame;
jQuery(document).on( 'click', '.tpath_img_upload_button', function( event ){
event.preventDefault();
// If the media frame already exists, reopen it.
if ( file_frame ) {
file_frame.open();
return;
}
// Create the media frame.
file_frame = wp.media.frames.file_frame = wp.media({
title: '<?php esc_html_e( 'Select image', 'greenture' ); ?>',
button: {
text: '<?php esc_html_e( 'Upload image', 'greenture' ); ?>',
},
multiple: false
});
// When an image is selected, run a callback.
file_frame.on( 'select', function() {
attachment = file_frame.state().get('selection').first().toJSON();
jQuery('#greenture_cat_thumbnail_image').val( attachment.url );
jQuery('.tpath_img_remove_button').show();
});
// Finally, open the modal.
if( file_frame ) {
file_frame.open();
}
});
jQuery(document).on( 'click', '.tpath_img_remove_button', function( event ){
jQuery('#greenture_cat_thumbnail_image').val('');
jQuery('.tpath_img_remove_button').hide();
return false;
});
</script>
</td>
</tr>
<?php
}
}
add_action( 'category_edit_form_fields', 'greenture_category_taxonomy_edit_meta_fields', 10, 2 );
if ( ! function_exists( 'greenture_save_category_taxonomy_custom_meta' ) ) {
function greenture_save_category_taxonomy_custom_meta( $term_id ) {
if ( isset( $_POST['greenture_cat_thumbnail_image'] ) ) {
$tpath_term_id = $term_id;
$term_meta = get_option( "taxonomy_$tpath_term_id" );
$term_meta['greenture_thumbnail_image'] = esc_url($_POST['greenture_cat_thumbnail_image']);
// Save the option array.
update_option( "taxonomy_$tpath_term_id", $term_meta );
}
}
}
add_action( 'edited_category', 'greenture_save_category_taxonomy_custom_meta', 10, 2 );
add_action( 'create_category', 'greenture_save_category_taxonomy_custom_meta', 10, 2 );
/* =========================================================
* Get FontAwesome Icons Array
* ========================================================= */
if ( ! function_exists( 'greenture_get_fontawesome_icon_array' ) ) {
function greenture_get_fontawesome_icon_array() {
$pattern = '/\.(fa-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
$fontawesome_path = GREENTURE_THEME_URL . '/css/font-awesome.css';
$response = wp_remote_get( $fontawesome_path );
if( is_array($response) ) {
$subject = $response['body']; // use the content
}
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
$icons = array();
foreach($matches as $match){
$icons[$match[1]] = $match[2];
}
return $icons;
}
}
/* =========================================================
* Get Glyphicons Array
* ========================================================= */
if ( ! function_exists( 'greenture_get_glyphicons_array' ) ) {
function greenture_get_glyphicons_array() {
$pattern = '/\.(glyphicon-(?:\w+(?:-)?)+):before\s+{\s*content:\s*"(.+)";\s+}/';
$glyphicon_path = GREENTURE_THEME_URL . '/css/bootstrap.css';
$response = wp_remote_get( $glyphicon_path );
if( is_array($response) ) {
$subject = $response['body']; // use the content
}
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
$icons = array();
foreach($matches as $match){
$icons[$match[1]] = $match[2];
}
return $icons;
}
}
/* =========================================================
* Get Taxonomies List array for any post type
* ========================================================= */
if ( ! function_exists( 'greenture_get_taxonomy_terms_array' ) ) {
function greenture_get_taxonomy_terms_array($taxonomy, $post_type, $msg) {
$list_groups = get_categories('taxonomy='.$taxonomy.'&post_type='.$post_type.'');
$groups_list[0] = $msg;
if( !empty($list_groups) ) {
foreach ($list_groups as $groups) {
$group_name = $groups->name;
$termid = $groups->term_id;
$groups_list[$termid] = $group_name;
}
}
if( isset($groups_list) ) {
return $groups_list;
}
}
}
/* =========================================================
* Update Post Views Count to find Popular Posts
* ========================================================= */
if ( ! function_exists( 'greenture_set_post_views_count' ) ) {
function greenture_set_post_views_count() {
$post = greenture_get_global_var( 'post' );
if('post' == get_post_type() && is_single()) {
$post_id = $post->ID;
if(!empty($post_id)) {
$count_key = 'greenture_post_views_count';
$count = get_post_meta($post_id, $count_key, true);
if($count == '') {
$count = 0;
delete_post_meta($post_id, $count_key);
add_post_meta($post_id, $count_key, '0');
} else {
$count++;
update_post_meta($post_id, $count_key, $count);
}
}
}
}
}
add_action('wp_head', 'greenture_set_post_views_count');
/* ==================================================================
* Add Current Category Class to Categories List on Single Post
* ================================================================== */
if ( ! function_exists( 'greenture_current_cat_on_single_posts' ) ) {
function greenture_current_cat_on_single_posts($output) {
$post = greenture_get_global_var( 'post' );
if(is_single()) {
$categories = wp_get_post_categories($post->ID);
if($categories) {
foreach($categories as $value) {
if(preg_match('#item-' . $value . '">#', $output)) {
$output = str_replace('item-' . $value . '">', 'item-' . $value . ' current-cat">', $output);
}
}
}
}
return $output;
}
}
add_filter('wp_list_categories', 'greenture_current_cat_on_single_posts');
/* =========================================================
* Get RGB values from Hexadecimal
* ========================================================= */
function greenture_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = array($r, $g, $b);
return $rgb;
}
/* ==================================================================
* Parallax Menu Links Creation
* ================================================================== */
if ( ! function_exists( 'greenture_get_parallax_link' ) ) {
function greenture_get_parallax_link( $item ) {
$wp_query = greenture_get_global_var( 'wp_query' );
$post_data = $link = $item_object_id = '';
// Front and Blog page
$blog_page_id = get_option('page_for_posts');
$front_page_id = get_option('page_on_front');
// Get URL
if( !is_page_template( 'template-parallax-page' ) ) {
$blog_url = esc_url( home_url() ) . '/';
} else {
$blog_url = '';
}
$front_url = is_front_page() ? esc_url( $blog_url ) . '#section-top' : esc_url( home_url() ) . '/';
if ( !empty( $item->object_id ) ) {
$post_data = get_post($item->object_id);
$item_object_id = $item->object_id;
}
$slug = ( isset($post_data->post_name) ) ? $post_data->post_name : '';
// Regular link for blog - all other menu items are anchors
if( $blog_page_id == $item_object_id || $item->megamenu_menutype == 'page' ) {
$link = ! empty( $item->url ) ? esc_attr( $item->url ) : '';
}
// Regular link for the front page or an anchors
elseif( $front_page_id == $item_object_id ) {
// Front page
if( is_front_page() ) {
$link = ! empty( $item->url ) ? esc_url( $blog_url ) . '#section-top' : '';
} else {
// Regular link
$link = ! empty( $item->url ) ? esc_attr( $item->url ) : '';
}
} else {
if( $item->megamenu_menutype == 'section' ) {
$link = ! empty( $slug ) ? esc_url( $blog_url ) . '#section-' . esc_attr( $slug ) : '';
} else {
$link = ! empty( $item->url ) ? esc_attr( $item->url ) : '';
}
}
return $link;
}
}
/* ==================================================================
* Parallax Custom Query
* ================================================================== */
if ( ! function_exists( 'greenture_parallax_front_query' ) ) {
function greenture_parallax_front_query() {
$pages_query = array();
$tpath_menu_items = '';
// Check for primary navigation
if( has_nav_menu( 'primary-menu' ) ) {
// Primary navigation ID
$tpath_menu_theme_locations = get_nav_menu_locations();
$tpath_menu_objects = get_term( $tpath_menu_theme_locations['primary-menu'] , 'nav_menu' );
$tpath_menu_id = $tpath_menu_objects->term_id;
$menu_args = array(
'orderby' => 'menu_order'
);
$tpath_menu_items = wp_get_nav_menu_items( $tpath_menu_id, $menu_args );
// Create array of query for WP_Query()
foreach( (array) $tpath_menu_items as $key => $tpath_menu_item ) {
$blog_page_id = get_option('page_for_posts');
$front_page_id = get_option('page_on_front');
if( $tpath_menu_item->megamenu_menutype == 'section' && $blog_page_id != $tpath_menu_item->object_id && $front_page_id != $tpath_menu_item->object_id) {
$pages_query[] = $tpath_menu_item->object_id;
}
}
// Return query
if( !empty( $pages_query ) ) {
// Query Args
$tpath_query = array(
'post_type' => 'page',
'post__in' => $pages_query,
'posts_per_page' => count($pages_query),
'orderby' => 'post__in'
);
return $tpath_query;
} else {
return array();
}
}
}
}
/* ==================================================================
* Parallax Additional Sections Query
* ================================================================== */
if ( ! function_exists( 'greenture_parallax_additional_query' ) ) {
function greenture_parallax_additional_query( $ids ) {
$additional_query = array();
$query_ids = explode(',', $ids);
// Create array of query for WP_Query()
foreach( (array) $query_ids as $id => $value ) {
$blog_page_id = get_option('page_for_posts');
$front_page_id = get_option('page_on_front');
if( $blog_page_id != $value && $front_page_id != $value ) {
$additional_query[] = $value;
}
}
// Return query
if( !empty( $additional_query ) ) {
// Query Args
$tpath_additional_query = array(
'post_type' => 'page',
'post__in' => $additional_query,
'posts_per_page' => count($additional_query),
'orderby' => 'post__in'
);
return $tpath_additional_query;
} else {
return array();
}
}
}
/* =============================================================
* Breadcrumbs
* ============================================================= */
if( ! function_exists( 'greenture_breadcrumbs' ) ) {
function greenture_breadcrumbs() {
$breadcrumbs = new greenture_Breadcrumbs();
$breadcrumbs->greenture_display_breadcrumbs();
}
}
/* =============================================================
* Disable default breadcrumbs from bbPress
* ============================================================= */
add_filter( 'bbp_no_breadcrumb', '__return_true' );
/* =========================================================
* Display Related Team Members on Single Post pages
* ========================================================= */
if( ! function_exists( "greenture_related_team_members" ) ) {
function greenture_related_team_members() {
$post = greenture_get_global_var( 'post' );
$categories = get_the_terms( $post->ID, 'team_member_categories' );
if($categories) {
$category_ids = array();
foreach($categories as $category) {
$category_ids[] = $category->term_id;
}
$args = array(
'post_type' => 'greenture_team_member',
'post__not_in' => array($post->ID),
'posts_per_page' => 4,
'tax_query' => array(
array(
'taxonomy' => 'team_member_categories',
'field' => 'id',
'terms' => $category_ids,
),
),
);
$related_query = new WP_Query($args);
if( $related_query->have_posts() ) { ?>
<div class="col-xs-12 related-team-members-wrapper">
<div class="related-post-inner">
<h5 class="related-member-title"><?php esc_html_e('Similar Attorneys', 'greenture'); ?></h5>
<div class="row">
<ul class="related-members">
<?php while ($related_query->have_posts()) {
$related_query->the_post();
$post = greenture_get_global_var( 'post' );
$team_img = '';
$team_img = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'greenture-team-size' );
$member_role = get_post_meta( $post->ID, 'greenture_member_designation', true );
if( has_post_thumbnail() ) { ?>
<li class="col-sm-3 col-xs-12">
<div class="related-member-item team-item">
<div class="team-image-wrapper">
<?php if( isset( $team_img ) && $team_img != '' ) { ?>
<div class="team-item-img">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>"><img class="img-responsive" src="<?php echo esc_url( $team_img[0] ); ?>" alt="<?php the_title(); ?>" /></a>
</div>
<?php } ?>
</div>
<div class="team-content-wrapper">
<h6 class="team-member-name"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="post-link"><?php the_title(); ?></a></h6>
<?php if( isset( $member_role ) && $member_role != '' ) { ?>
<div class="team-member-designation">
<p class="text-italic"><?php echo esc_html( $member_role ); ?></p>
</div>
<?php } ?>
<div class="team-member-btn"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="btn btn-fbox btn-simple-text"><?php esc_html_e( 'Read More', 'greenture' ); ?> <i class="ionicons ion-arrow-right-a"></i></a></div>
</div>
</div>
</li>
<?php } else { ?>
<li class="col-sm-3">
<div class="related-member-item">
<div class="entry-thumbnail">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="post-img">
<img src="<?php echo GREENTURE_THEME_URL; ?>/images/empty-500.jpg" class="img-responsive" alt="<?php the_title_attribute(); ?>" />
</a>
</div>
<div class="team-content-wrapper">
<h6 class="team-member-name"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="post-link"><?php the_title(); ?></a></h6>
<?php if( isset( $member_role ) && $member_role != '' ) { ?>
<div class="team-member-designation">
<p class="text-italic"><?php echo esc_html( $member_role ); ?></p>
</div>
<?php } ?>
<div class="team-member-btn"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="btn btn-fbox btn-simple-text"><?php esc_html_e( 'Contact Now', 'greenture' ); ?></a></div>
</div>
</div>
</li>
<?php }
} ?>
</ul>
</div>
</div>
</div>
</div>
<?php
}
wp_reset_postdata();
}
}
}
/* =========================================================
* Display Related Services on Single Post pages
* ========================================================= */
if( ! function_exists( "greenture_related_service_items" ) ) {
function greenture_related_service_items() {
$post = greenture_get_global_var( 'post' );
$item_cats = get_the_terms( $post->ID, 'service_tags' );
$item_array = array();
if( $item_cats ) {
foreach( $item_cats as $item_cat ) {
$item_array[] = $item_cat->term_id;
}
}
if( $item_cats ) {
$args = array(
'post__not_in' => array($post->ID),
'post_type' => 'greenture_service',
'posts_per_page' => 6,
'orderby' => 'date',
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'service_tags',
'field' => 'id',
'terms' => $item_array,
),
)
);
wp_enqueue_script( 'greenture-owl-crrosul' );
wp_enqueue_style( 'greenture-owl-crrosul' );
$service_related_query = new WP_Query($args);
if( $service_related_query->have_posts() ) { ?>
<div class="service-related-items-wrapper">
<div class="related-post-inner">
<div class="clearfix service-related-title">
<h2 class="related-services-title"><?php echo esc_html__('Related', 'greenture'); ?>
<span><?php echo esc_html__('Projects', 'greenture'); ?></span></h2>
</div>
<div class="related-service-slider">
<?php while ($service_related_query->have_posts()) {
$service_related_query->the_post();
$post = greenture_get_global_var( 'post' );
$excerpt_block = get_post_meta( $post->ID, 'greenture_service_excerpt_block', true );
?>
<div class="related-service">
<div class="related-service-item service-item-wrapper">
<div class="service-image-wrapper service-item-img">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="post-img">
<?php the_post_thumbnail( 'greenture-feature-box' ); ?>
</a>
<?php }else { ?>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="post-img">
<img src="<?php echo GREENTURE_THEME_URL; ?>/images/empty-500.jpg" class="img-responsive" alt="<?php the_title_attribute(); ?>" />
</a>
<?php } ?>
</div>
<div class="service-content-wrapper">
<div class="service-content-top">
<h6 class="service-name">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="post-link"><?php the_title(); ?></a>
</h6>
<span class="service-sub-title"><?php echo get_post_meta( $post->ID, 'greenture_sub_block', true ); ?></span>
</div>
<div class="service-btn"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" class="btn-type-dark"><?php esc_html_e( 'Learn More', 'greenture' ); ?></a></div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php }
wp_reset_postdata();
}
}
}
/* =========================================================
* Show Block
* ========================================================= */
if( ! function_exists( "greenture_block" ) ) {
function greenture_block( $block_id ) {
if($block_id) {
$args = array(
'post_type' => 'greenture_block',
'post__in' => array( $block_id )
);
$block_query = new WP_Query($args);
$output = '';
if( $block_query->have_posts() ) {
while ($block_query->have_posts()) {
$block_query->the_post();
$post = greenture_get_global_var( 'post' );
$post_content = $post->post_content;
$output = '<div class="tpath-block tpath-block-wrapper">';
$content = wpautop( preg_replace( '/<\/?p\>/', "\n", $post_content ) . "\n" );
$output .= do_shortcode( shortcode_unautop( $post_content ) );
$output .= '</div>';
}
}
wp_reset_postdata();
return $output;
}
}
}
/* =============================================================
* Remove Extra P Tags
* ============================================================= */
function greenture_shortcodes_formatter($content) {
$block = join("|", array("greenture_section_title", "greenture_about_me", "greenture_feature_box", "greenture_iconslist"));
// opening tag
$shortcode = preg_replace("/(<p>)?\[($block)(\s[^\]]+)?\](<\/p>|<br \/>)?/","[$2$3]",$content);
// closing tag
$shortcode = preg_replace("/(<p>)?\[\/($block)](<\/p>|<br \/>)?/","[/$2]",$shortcode);
return $shortcode;
}
add_filter('the_content', 'greenture_shortcodes_formatter');
add_filter('widget_text', 'greenture_shortcodes_formatter');
/* =============================================================
* HTML Allowed Tags for wp_kses
* ============================================================= */
if( ! function_exists('greenture_wp_allowed_tags') ) {
function greenture_wp_allowed_tags() {
$allowed_tags = wp_kses_allowed_html( 'post' );
// iframe
$allowed_tags['iframe'] = array(
'src' => array(),
'height' => array(),
'width' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
);
// style
$allowed_tags['style'] = array(
'type' => array(),
);
// link
$allowed_tags['link'] = array(
'type' => array(),
'href' => array(),
'rel' => array(),
'sizes' => array(),
);
// meta
$allowed_tags['meta'] = array(
'name' => array(),
'content' => array(),
);
// select
$allowed_tags['select'] = array(
'name' => array(),
'multiple' => array(),
'required' => array(),
'class' => array(),
'size' => array(),
);
// option
$allowed_tags['option'] = array(
'id' => array(),
'value' => array(),
'label' => array(),
'selected' => array(),
);
// input
$allowed_tags['input'] = array(
'type' => array(),
'id' => array(),
'class' => array(),
'value' => array(),
'name' => array(),
'checked' => array(),
'readonly' => array(),
);
return $allowed_tags;
}
}
/* =============================================================
* Events Calendar Archive
* ============================================================= */
function greenture_is_events_archive() {
if( class_exists( 'Tribe__Events__Main' ) ) {
if( tribe_is_month() || tribe_is_day() || tribe_is_past() || tribe_is_upcoming() || class_exists( 'TribeEventsPro' ) && ( tribe_is_week() || tribe_is_photo() || tribe_is_map() ) ) {
return true;
} else {
return false;
}
} else {
return false;
}
}
/* =============================================================
* Search Filters
* ============================================================= */
if( ! is_admin() ) {
function greenture_search_filter($query) {
if( is_search() && $query->is_search ) {
if( isset( $_GET ) && count( $_GET ) > 1 ) {
return $query;
}
$post_type = array('post');
$query->set('post_type', $post_type);
}
return $query;
}
add_filter('pre_get_posts', 'greenture_search_filter');
}
/* =============================================================
* Add Custom Taxonomy Tags to Archive
* ============================================================= */
function greenture_add_cpt_tags_to_archive($query) {
if( ! is_admin() ) {
if( $query->is_main_query() && ( is_tax( 'portfolio_categories' ) || is_tax( 'portfolio_skills' ) || is_tax( 'service_categories' ) || is_tax( 'service_tags' ) || is_tax( 'team_member_categories' ) ) ) {
$post_type = array('post', 'greenture_portfolio', 'greenture_service', 'greenture_team_member');
$query->set('post_type', $post_type);
}
return $query;
}
}
add_filter('pre_get_posts', 'greenture_add_cpt_tags_to_archive');
/* ==================================================================
* Revolution Slider Disable Notice
* ================================================================== */
if( is_admin() ) {
if( function_exists( 'set_revslider_as_theme' )){
add_action( 'init', 'greenture_set_Rev_Slider_as_theme' );
function greenture_set_Rev_Slider_as_theme() {
update_option('revslider-valid-notice', 'false');
set_revslider_as_theme();
}
}
}