* @package Agama * @since 1.0.1 */ // Do not allow direct access to the file. if( ! defined( 'ABSPATH' ) ) { exit; } if ( ! function_exists( 'agama_register_elementor_locations' ) ) { /** * Elementor Locations * * Register the Elementor locations. * * @since 1.6.1 * @return void */ function agama_register_elementor_locations( $elementor_theme_manager ) { $elementor_theme_manager->register_location( 'header' ); $elementor_theme_manager->register_location( 'archive' ); $elementor_theme_manager->register_location( 'single' ); $elementor_theme_manager->register_location( 'main-sidebar' ); $elementor_theme_manager->register_location( 'footer' ); } } add_action( 'elementor/theme/register_locations', 'agama_register_elementor_locations' ); if ( ! function_exists( 'agama_navbar_buttons' ) ) { /** * Navbar Buttons * * Display the navbar buttons in primary menu location. * * @param string $items The HTML list content for the menu items. * @param stdClass $args An object containing wp_nav_menu() arguments. * * @since 1.6.1 * @return array */ function agama_navbar_buttons( $items, $args ) { if ( 'primary' == $args->theme_location && 'default' !== agama_header_style() ) { if ( has_filter( 'agama_primary_menu_items' ) ) { /** * Filter: agama_primary_menu_items * * @hooked none * * @since 1.6.1 */ $items .= apply_filters( 'agama_primary_menu_items', false ); } $items .= ''; // End of Primary Menu ob_start(); get_template_part( 'template-parts/navbar', 'buttons' ); $navbar_buttons = ob_get_contents(); ob_end_clean(); $items .= $navbar_buttons; } return $items; } } add_action( 'wp_nav_menu_items', 'agama_navbar_buttons', 10, 2 ); /** * Header Distance * * Output header distance element after header wrapper. * * @since 1.4.4 */ function agama_header_distance() { $header = esc_attr( get_theme_mod( 'agama_header_style', 'transparent' ) ); if( 'transparent' == $header || 'sticky' == $header ) { echo '
'; } } add_action( 'agama/after_header_wrapper', 'agama_header_distance' ); if( ! function_exists( 'agama_header_image' ) ) : /** * Header Image * * Render the Agama theme header image. * * @since 1.2.9 * @since 1.5.3 Updated the code. * @return mixed */ function agama_header_image() { $particles = esc_attr( get_theme_mod( 'agama_header_image_particles', true ) ); if ( get_header_image() ) : ?>
'; echo '
'; printf( '%s', get_the_time('d') ); // Get day printf( '%s', get_the_time('m, Y') ); // Get month, year echo '
'; echo '
'; printf( '%s', Agama::post_format() ); echo '
'; echo ''; } } } } add_action( 'agama_blog_post_date_and_format', 'agama_render_blog_post_date', 10 ); /** * Social Share Icons * * @since 1.3.7 */ if( ! function_exists( 'agama_social_share' ) ) { function agama_social_share() { $enabled = esc_attr( get_theme_mod( 'agama_share_box', true ) ); $visibility = esc_attr( get_theme_mod( 'agama_share_box_visibility', 'posts' ) ); $icons = get_theme_mod( 'agama_social_share_icons', array( 'facebook', 'twitter', 'pinterest', 'linkedin', 'rss', 'email' ) ); // Check if Social Share is Enabled if( $enabled && $visibility == 'posts' && is_single() ) { $enabled = true; } else if( $enabled && $visibility == 'pages' && is_page() ) { $enabled = true; } else if( $enabled && $visibility == 'all' ) { $enabled = true; } else { $enabled = false; } // Translation if( is_page() ) { $translate = esc_html__( 'Share this Page', 'agama' ); } else if( is_single() ) { $translate = esc_html__( 'Share this Post', 'agama' ); } else { $translate = esc_html__( 'Share', 'agama' ); } if( $enabled ) { echo '
'; echo ''. $translate .''; echo '
'; foreach( $icons as $icon ) { // Set default values. $title = ucfirst( $icon ); $fa = $icon; // Set Parameters switch( $icon ) { case 'facebook': $url = sprintf( 'https://www.facebook.com/sharer/sharer.php?u=%s', get_permalink() ); break; case 'twitter': $url = sprintf( 'https://twitter.com/intent/tweet?url=%s', get_permalink() ); break; case 'pinterest': $url = sprintf( 'http://pinterest.com/pin/create/button/?url=%s&media=%s', get_permalink(), get_the_post_thumbnail_url() ); break; case 'linkedin': $url = sprintf( 'http://www.linkedin.com/shareArticle?mini=true&url=%s', get_permalink() ); $title = esc_html__( 'LinkedIn', 'agama' ); break; case 'rss': $url = sprintf( '%s?feed=rss2&withoutcomments=1', get_permalink() ); $title = strtoupper( $title ); break; case 'email': $url = sprintf( 'mailto:?&subject=%s&body=%s', rawurlencode( get_the_title() ), get_permalink() ); $fa = 'at'; break; } // Output Share Icons printf( '', esc_url( $url ), 'si-' . esc_attr( $icon ), esc_html( $title ), esc_attr( $fa ), esc_attr( $fa ) ); } echo '
'; echo '
'; } } } add_action( 'agama_social_share', 'agama_social_share' ); /** * Render Blog Post Meta * * @since 1.0.1 */ if( ! function_exists( 'agama_render_blog_post_meta' ) ) { function agama_render_blog_post_meta() { if( get_theme_mod( 'agama_blog_post_meta', true ) ) { $author_id = esc_attr( get_the_author_meta( 'ID' ) ); echo '

'; // Display blog post author. if( get_theme_mod( 'agama_blog_post_author', true ) ) { printf( '%s %s', '', esc_url( get_author_posts_url( $author_id ) ), esc_attr( get_the_author_meta( 'display_name', $author_id ) ), esc_html( ucfirst( get_the_author_meta( 'display_name', $author_id ) ) ) ); } // Display blog post publish date. if( get_theme_mod( 'agama_blog_post_date', true ) ) { printf( '%s %s %s', '/', '', get_the_time('F j, Y') ); } // Display next details only on list blog layout or on single post page. if( get_theme_mod('agama_blog_layout', 'list') == 'list' || is_single() ) { // Display post category. if( get_theme_mod( 'agama_blog_post_category', true ) ) { printf( '%s %s %s', '/', '', get_the_category_list(', ') ); } // Display post comment counter. if( comments_open() && get_theme_mod( 'agama_blog_post_comments', true ) ) { printf( '%s %s %s', '/', '', get_comments_link(), get_comments_number().__( ' comments', 'agama' ) ); } } echo '

'; } } } add_action( 'agama_blog_post_meta', 'agama_render_blog_post_meta', 10 ); /** * Agama Credits * * @since 1.0.1 */ if( ! function_exists( 'agama_render_credits' ) ) { function agama_render_credits() { echo html_entity_decode( get_theme_mod( 'agama_footer_copyright', sprintf( __( '2015 - 2022 © Powered by %s.', 'agama' ), 'Theme Vision' ) ) ); } } add_action( 'agama_credits', 'agama_render_credits' ); /* Omit closing PHP tag to avoid "Headers already sent" issues. */