', esc_url( get_bloginfo( 'pingback_url' ) ) ); } } add_action( 'wp_head', 'aster_photography_pingback_header' ); /** * Get all posts for customizer Post content type. */ function aster_photography_get_post_choices() { $aster_photography_choices = array( '' => esc_html__( '--Select--', 'aster-photography' ) ); $aster_photography_args = array( 'numberposts' => -1 ); $aster_photography_posts = get_posts( $aster_photography_args ); foreach ( $aster_photography_posts as $aster_photography_post ) { $aster_photography_id = $aster_photography_post->ID; $aster_photography_title = $aster_photography_post->post_title; $aster_photography_choices[ $aster_photography_id ] = $aster_photography_title; } return $aster_photography_choices; } /** * Get all pages for customizer Page content type. */ function aster_photography_get_page_choices() { $aster_photography_choices = array( '' => esc_html__( '--Select--', 'aster-photography' ) ); $aster_photography_pages = get_pages(); foreach ( $aster_photography_pages as $aster_photography_page ) { $aster_photography_choices[ $aster_photography_page->ID ] = $aster_photography_page->post_title; } return $aster_photography_choices; } /** * Get all categories for customizer Category content type. */ function aster_photography_get_post_cat_choices() { $aster_photography_choices = array( '' => esc_html__( '--Select--', 'aster-photography' ) ); $aster_photography_cats = get_categories(); foreach ( $aster_photography_cats as $aster_photography_cat ) { $aster_photography_choices[ $aster_photography_cat->term_id ] = $aster_photography_cat->name; } return $aster_photography_choices; } /** * Get all donation forms for customizer form content type. */ function aster_photography_get_post_donation_form_choices() { $aster_photography_choices = array( '' => esc_html__( '--Select--', 'aster-photography' ) ); $aster_photography_posts = get_posts( array( 'post_type' => 'give_forms', 'numberposts' => -1, ) ); foreach ( $aster_photography_posts as $aster_photography_post ) { $aster_photography_choices[ $aster_photography_post->ID ] = $aster_photography_post->post_title; } return $aster_photography_choices; } if ( ! function_exists( 'aster_photography_excerpt_length' ) ) : /** * Excerpt length. */ function aster_photography_excerpt_length( $aster_photography_length ) { if ( is_admin() ) { return $aster_photography_length; } return get_theme_mod( 'aster_photography_excerpt_length', 20 ); } endif; add_filter( 'excerpt_length', 'aster_photography_excerpt_length', 999 ); if ( ! function_exists( 'aster_photography_excerpt_more' ) ) : /** * Excerpt more. */ function aster_photography_excerpt_more( $aster_photography_more ) { if ( is_admin() ) { return $aster_photography_more; } return '…'; } endif; add_filter( 'excerpt_more', 'aster_photography_excerpt_more' ); if ( ! function_exists( 'aster_photography_sidebar_layout' ) ) { /** * Get sidebar layout. */ function aster_photography_sidebar_layout() { $aster_photography_sidebar_position = get_theme_mod( 'aster_photography_sidebar_position', 'right-sidebar' ); $aster_photography_sidebar_position_post = get_theme_mod( 'aster_photography_post_sidebar_position', 'right-sidebar' ); $aster_photography_sidebar_position_page = get_theme_mod( 'aster_photography_page_sidebar_position', 'right-sidebar' ); if ( is_home() ) { $aster_photography_sidebar_position = $aster_photography_sidebar_position_post; } elseif ( is_page() ) { $aster_photography_sidebar_position = $aster_photography_sidebar_position_page; } return $aster_photography_sidebar_position; } } if ( ! function_exists( 'aster_photography_is_sidebar_enabled' ) ) { /** * Check if sidebar is enabled. */ function aster_photography_is_sidebar_enabled() { $aster_photography_sidebar_position = get_theme_mod( 'aster_photography_sidebar_position', 'right-sidebar' ); $aster_photography_sidebar_position_post = get_theme_mod( 'aster_photography_post_sidebar_position', 'right-sidebar' ); $aster_photography_sidebar_position_page = get_theme_mod( 'aster_photography_page_sidebar_position', 'right-sidebar' ); $aster_photography_sidebar_enabled = true; if ( is_single() || is_archive() || is_search() ) { if ( 'no-sidebar' === $aster_photography_sidebar_position ) { $aster_photography_sidebar_enabled = false; } } elseif ( is_home() ) { if ( 'no-sidebar' === $aster_photography_sidebar_position || 'no-sidebar' === $aster_photography_sidebar_position_post ) { $aster_photography_sidebar_enabled = false; } } elseif ( is_page() ) { if ( 'no-sidebar' === $aster_photography_sidebar_position || 'no-sidebar' === $aster_photography_sidebar_position_page ) { $aster_photography_sidebar_enabled = false; } } return $aster_photography_sidebar_enabled; } } if ( ! function_exists( 'aster_photography_get_homepage_sections ' ) ) { /** * Returns homepage sections. */ function aster_photography_get_homepage_sections() { $aster_photography_sections = array( 'banner' => esc_html__( 'Banner Section', 'aster-photography' ), 'product' => esc_html__( 'Product Section', 'aster-photography' ), ); return $aster_photography_sections; } } /** * Renders customizer section link */ function aster_photography_section_link( $aster_photography_section_id ) { $aster_photography_section_name = str_replace( 'aster_photography_', ' ', $aster_photography_section_id ); $aster_photography_section_name = str_replace( '_', ' ', $aster_photography_section_name ); $aster_photography_starting_notation = '#'; ?> false, 'show_title' => true, 'show_browse' => false, ); breadcrumb_trail( $aster_photography_args ); } add_action( 'aster_photography_breadcrumb', 'aster_photography_breadcrumb', 10 ); /** * Add separator for breadcrumb trail. */ function aster_photography_breadcrumb_trail_print_styles() { $aster_photography_breadcrumb_separator = get_theme_mod( 'aster_photography_breadcrumb_separator', '/' ); $aster_photography_style = ' .trail-items li::after { content: "' . $aster_photography_breadcrumb_separator . '"; }'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped $aster_photography_style = apply_filters( 'aster_photography_breadcrumb_trail_inline_style', trim( str_replace( array( "\r", "\n", "\t", ' ' ), '', $aster_photography_style ) ) ); if ( $aster_photography_style ) { echo "\n" . '' . "\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } add_action( 'wp_head', 'aster_photography_breadcrumb_trail_print_styles' ); /** * Pagination for archive. */ function aster_photography_render_posts_pagination() { $aster_photography_is_pagination_enabled = get_theme_mod( 'aster_photography_enable_pagination', true ); if ( $aster_photography_is_pagination_enabled ) { $aster_photography_pagination_type = get_theme_mod( 'aster_photography_pagination_type', 'default' ); if ( 'default' === $aster_photography_pagination_type ) : the_posts_navigation(); else : the_posts_pagination(); endif; } } add_action( 'aster_photography_posts_pagination', 'aster_photography_render_posts_pagination', 10 ); /** * Pagination for single post. */ function aster_photography_render_post_navigation() { the_post_navigation( array( 'prev_text' => '⟵ ', 'next_text' => ' ⟶', ) ); } add_action( 'aster_photography_post_navigation', 'aster_photography_render_post_navigation' ); /** * Adds footer copyright text. */ function aster_photography_output_footer_copyright_content() { $aster_photography_theme_data = wp_get_theme(); $aster_photography_copyright_text = get_theme_mod('aster_photography_footer_copyright_text'); if (!empty($aster_photography_copyright_text)) { $aster_photography_text = esc_html($aster_photography_copyright_text); } else { $aster_photography_default_text = ' ' . esc_html($aster_photography_theme_data->get('Name')) . '' . ' ' . esc_html__('by', 'aster-photography') . ' ' . esc_html(ucwords($aster_photography_theme_data->get('Author'))) . ''; /* translators: %s: a link to WordPress */ $aster_photography_default_text .= sprintf(esc_html__(' | Powered by %s', 'aster-photography'), 'WordPress. '); $aster_photography_text = $aster_photography_default_text; } ?>
admin_url( 'admin-ajax.php' ) ) ); wp_enqueue_style( 'aster-photography-notice-style', get_template_directory_uri() . '/resource/css/notice.css' ); } add_action( 'admin_enqueue_scripts', 'aster_photography_getpage_css' ); add_action('wp_ajax_aster_photography_dismissable_notice', 'aster_photography_dismissable_notice'); function aster_photography_switch_theme() { delete_user_meta(get_current_user_id(), 'aster_photography_dismissable_notice'); } add_action('after_switch_theme', 'aster_photography_switch_theme'); function aster_photography_dismissable_notice() { update_user_meta(get_current_user_id(), 'aster_photography_dismissable_notice', true); die(); } function aster_photography_deprecated_hook_admin_notice() { global $aster_photography_pagenow; // Check if the current page is the one where you don't want the notice to appear if ( $aster_photography_pagenow === 'themes.php' && isset( $_GET['page'] ) && $_GET['page'] === 'aster-photography-getting-started' ) { return; } $aster_photography_dismissed = get_user_meta( get_current_user_id(), 'aster_photography_dismissable_notice', true ); if ( !$aster_photography_dismissed) { ?>