PATH:
home
/
centosnipponia
/
public_html
/
BAK_driewielscootercom
/
wp-content
/
themes
/
sydney-pro-ii
/
inc
/
modules
<?php /** * Functions for the extended blog module * * @package Sydney */ if ( !Sydney_Modules::is_module_active( 'ext-blog' ) ) { return; } /** * Enqueue blog related styles */ function sydney_enqueue_ext_blog_styles() { wp_enqueue_style( 'sydney-ext-blog-styles', get_template_directory_uri() . '/css/modules/ext-blog.min.css' ); } add_action( 'wp_enqueue_scripts', 'sydney_enqueue_ext_blog_styles', 9 ); /** * Enqueue blog related styles * * Separate function than styles in order to load later */ function sydney_enqueue_ext_blog_scripts() { //Pagination $pagination = get_theme_mod( 'pagination_type', 'numeric' ); if ( 'numeric' !== $pagination ) { wp_enqueue_script( 'sydney-inf-scroll', get_template_directory_uri() . '/js/infinite-load.js', '','', true ); } //Reading progress $single_post_reading_progress = get_theme_mod( 'single_post_reading_progress', 0 ); if ( is_singular( 'post' ) && $single_post_reading_progress ) { wp_enqueue_script( 'sydney-reading-progress', get_template_directory_uri() . '/js/modules/reading-progress.js', '','', true ); } } add_action( 'wp_enqueue_scripts', 'sydney_enqueue_ext_blog_scripts' ); /** * Blog index hero grid */ function sydney_blog_index_hero() { if ( !is_home() || is_paged() ) { return; } $enabled = get_theme_mod( 'enable_featured_posts', 0 ); if ( !$enabled ) { return; } $container = get_theme_mod( 'featured_posts_width', 'container' ); $ids = get_theme_mod( 'featured_posts_ids' ); $layout = get_theme_mod( 'featured_posts_layout', 'layout1' ); $show_cats = get_theme_mod( 'featured_posts_cats', 1 ); $show_date = get_theme_mod( 'featured_posts_date', 1 ); if ( 'layout1' === $layout || 'layout3' === $layout ) { $number = 3; } else { $number = 5; } $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number ); if ( is_array( $ids ) && array_filter( $ids ) ) { $postids = array( 'post__in' => $ids ); $args = array_merge( $args, $postids ); } $query = new WP_Query( $args ); if ( $query->have_posts() ) { ?> <div class="featured-posts featured-<?php echo esc_attr( $layout ); ?>"> <div class="<?php echo esc_attr( $container ); ?>"> <div class="featured-posts-inner"> <?php while ( $query->have_posts() ) : $query->the_post(); ?> <?php global $post; $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post -> ID ), 'large' ); ?> <div class="featured-post" style="background-image:url(<?php echo esc_url( $image[0] ); ?>);"> <div class="content"> <?php if ( $show_cats ) { sydney_post_categories(); } the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); if ( $show_date ) { sydney_posted_on(); } ?> </div> </div> <?php endwhile; ?> </div> </div> </div> <?php } //end have_posts check wp_reset_postdata(); } add_action( 'sydney_after_header', 'sydney_blog_index_hero', 30 ); /** * Featured boxes */ function sydney_featured_boxes() { if ( !is_home() || is_paged() ) { return; } $enabled = get_theme_mod( 'enable_featured_boxes', 0 ); if ( !$enabled ) { return; } ?> <div class="featured-boxes"> <div class="container"> <div class="row"> <?php for( $i = 0; $i < 3; $i++ ) { $image[$i] = get_theme_mod( 'featured_box_image_' . $i ); $text[$i] = get_theme_mod( 'featured_box_text_' . $i ); $link[$i] = get_theme_mod( 'featured_box_link_' . $i ); ?> <div class="col-md-4"> <div class="featured-box" style="background-image:url(<?php echo esc_url( $image[$i] ); ?>);"> <a href="<?php echo esc_url( $link[$i] ); ?>"><?php echo esc_html( $text[$i] ); ?></a> </div> </div> <?php } ?> </div> </div> </div> <?php } add_action( 'sydney_after_header', 'sydney_featured_boxes', 40 ); /** * Post sharing */ function sydney_post_sharing_links() { $enable = get_theme_mod( 'enable_post_sharing', 0 ); if ( !$enable ) { return; } global $post; $post_url = urlencode( esc_url( get_permalink($post->ID) ) ); $post_title = urlencode( $post->post_title ); $sharing_title = get_theme_mod( 'single_post_share_title', esc_html__( 'Share this post:', 'sydney' ) ); $enabled_networks = get_theme_mod( 'single_post_sharing_networks', array( 'facebook', 'twitter', 'linkedin' ) ); $urls = array( 'facebook' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://www.facebook.com/sharer.php?u={url}' ) ), ), 'twitter' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://twitter.com/intent/tweet?url={url}&text={title}' ) ), ), 'linkedin' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://www.linkedin.com/sharing/share-offsite/?url={url}' ) ), ), 'reddit' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://reddit.com/submit?url={url}&title={title}' ) ), ), 'whatsapp' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'whatsapp://send/?text={url}' ) ), ), 'pinterest' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'http://pinterest.com/pin/create/link/?url={url}' ) ), ), 'telegram' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://t.me/share/url?url={url}&text={title}' ) ), ), 'weibo' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'http://service.weibo.com/share/share.php?url={url}&appkey=&title={title}&pic=&ralateUid=' ) ), ), 'vk' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'http://vk.com/share.php?url={url}&title={title}&comment={text}' ) ), ), 'ok' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&st.shareUrl={url}' ) ), ), 'xing' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'https://www.xing.com/spi/shares/new?url={url}' ) ), ), 'mail' => array( 'url' => str_replace( '{title}', $post_title, str_replace( '{url}', $post_url, 'mailto:?subject=' . $post->post_title . '&body={url}' ) ), ), ); $output = '<div class="sydney-post-sharing">'; if ( '' !== $sharing_title ) { $output .= '<h4>' . esc_html( $sharing_title ) . '</h4>'; } $output .= '<div class="sharing-elements">'; foreach ( $enabled_networks as $network ) { $output .= '<span class="sharing-element"><a target="_blank" href="' . $urls[$network]['url'] . '" class="share-button share-button-' . esc_attr( $network ) . '"><i class="sydney-svg-icon">' . sydney_get_svg_icon( 'icon-' . $network, false ) . '</i></a></span>'; } $output .= '</div>'; $output .= '</div>'; echo $output; } add_action( 'sydney_before_single_post_footer', 'sydney_post_sharing_links' ); /** * Remove archive labels */ function sydney_remove_archive_labels( $title ) { $disable = get_theme_mod( 'disable_archive_labels', 0 ); if ( !$disable ) { return $title; } if ( is_category() ) { $title = single_cat_title( '', false ); } elseif ( is_tag() ) { $title = single_tag_title( '', false ); } elseif ( is_author() ) { $title = '<span class="vcard">' . get_the_author() . '</span>'; } elseif ( is_year() ) { $title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); } elseif ( is_month() ) { $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); } elseif ( is_day() ) { $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); } elseif ( is_post_type_archive() ) { $title = post_type_archive_title( '', false ); } elseif ( is_tax() ) { $title = single_term_title( '', false ); } return $title; } add_filter( 'get_the_archive_title', 'sydney_remove_archive_labels' ); /** * Infinite load button */ function sydney_pro_infinite_load_button() { $pagination = get_theme_mod( 'pagination_type', 'numeric' ); if ( 'button' !== $pagination ) { return; } $load_more_button_text = get_theme_mod( 'load_more_button_text', esc_html__( 'Load more posts', 'sydney' ) ); echo '<div class="load-more-container"><div class="page-load-status"> <p class="infinite-scroll-request"> <span class="loader-ellips"><span class="loader-ellips__dot"></span><span class="loader-ellips__dot"></span><span class="loader-ellips__dot"></span><span class="loader-ellips__dot"></span></span> </p> </div> <div class="roll-button button load-more-posts">' . esc_html( $load_more_button_text ) . '</div> </div>'; } add_action( 'sydney_after_posts_navigation', 'sydney_pro_infinite_load_button' ); /** * Infinite load */ function sydney_infinite_load_row_class() { $pagination = get_theme_mod( 'pagination_type', 'numeric' ); if ( 'numeric' === $pagination ) { return; } $data = 'data-pagination=' . $pagination; return $data; } add_filter( 'sydney_posts_layout_row', 'sydney_infinite_load_row_class', 10, 1 ); /** * Post headers */ function sydney_single_post_headers() { if ( !is_singular( 'post' ) ) { //only for single posts return; } global $post; $layout = get_theme_mod( 'post_header_layout', 'layout1' ); $disable_title = get_post_meta( $post->ID, '_sydney_page_disable_title', true ); if ( 'layout1' === $layout || $disable_title ) { //default layout return; } $single_post_meta_position = get_theme_mod( 'single_post_meta_position', 'below-title' ); $container = get_theme_mod( 'post_header_container', 'container' ); ?> <div class="page-banner"> <div class="<?php echo esc_attr( $container ); ?>"> <div class="page-banner-inner"> <?php if ( has_post_thumbnail() ) : ?> <?php the_post_thumbnail( 'full', array( 'alt' => the_title_attribute( array( 'echo' => false, ) ), ) ); ?> <?php endif; ?> <?php if ( 'layout3' === $layout ) : ?> <div class="page-banner-overlay"></div> <header class="entry-header"> <div class="container"> <?php do_action( 'sydney_before_title' ); ?> <?php if ( 'post' === get_post_type() && 'above-title' === $single_post_meta_position ) : ?> <?php sydney_single_post_meta( 'entry-meta-above' ); ?> <?php endif; ?> <?php the_title( '<h1 class="title-post entry-title" ' . sydney_get_schema( "headline" ) . '>', '</h1>' ); ?> <?php if ( 'post' === get_post_type() && 'below-title' === $single_post_meta_position ) : ?> <?php sydney_single_post_meta( 'entry-meta-below' ); ?> <?php endif; ?> </div> </header><!-- .entry-header --> <?php endif; ?> </div> </div> </div> <?php } add_action( 'sydney_before_main_container_start', 'sydney_single_post_headers' ); /** * Reading time */ function sydney_reading_time() { $speed = get_theme_mod( 'reading_time_speed', 250 ); $before_time = get_theme_mod( 'reading_time_before' ); $after_time = get_theme_mod( 'reading_time_after', esc_html__( ' min read', 'sydney' ) ); global $post; $id = $post->ID; $content = get_post_field( 'post_content', $id ); $content = wp_strip_all_tags( $content ); $words = count( preg_split( '/\s+/', $content ) ); $reading_time = ceil( $words / $speed ); echo '<span class="post-reading-time">' . esc_html( $before_time . $reading_time . $after_time ) . '</span>'; } /** * Category form fields */ require get_template_directory() . "/inc/modules/class_sydney_archive_form_fields.php"; /** * Archive headers */ function sydney_archive_headers() { $archive_title_layout = get_theme_mod( 'archive_title_layout', 'layout1' ); if ( ( !is_category() && !is_tag() && !is_author() ) || 'layout1' === $archive_title_layout ) { return; } $container = get_theme_mod( 'archive_title_container', 'container' ); $image_id = ''; if ( is_category() ) { $cat_id = get_queried_object_id(); $image_id = get_term_meta( $cat_id, 'sydney-cat-img-id', true ); } ?> <div class="page-banner"> <div class="<?php echo esc_attr( $container ); ?>"> <div class="page-banner-inner cat-banner-inner"> <?php if ( $image_id ) : ?> <?php echo wp_get_attachment_image( $image_id, 'large' ); ?> <div class="page-banner-overlay"></div> <?php endif; ?> <header class="page-header"> <div class="container"> <?php do_action( 'sydney_before_title' ); the_archive_title( '<h1 class="archive-title">', '</h1>' ); the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?> </div> </header><!-- .page-header --> </div> </div> </div> <?php } add_action( 'sydney_before_main_container_start', 'sydney_archive_headers' ); /** * Add body class */ function sydney_reading_progress_body_class( $classes ) { $classes[] = 'hide-reading-progress'; return $classes; } add_filter( 'body_class', 'sydney_reading_progress_body_class' ); /** * Reading Progress Position */ function sydney_reading_progress_position() { if( ! is_singular( 'post' ) ) { return; } $single_post_reading_progress_position = get_theme_mod( 'single_post_reading_progress_position', 'top' ); $header_layout_desktop = get_theme_mod( 'header_layout_desktop', 'header_layout_2' ); if( 'top' === $single_post_reading_progress_position ) { if( in_array( $header_layout_desktop, array( 'header_layout_3', 'header_layout_4', 'header_layout_5' ) ) ) { add_action( 'sydney_before_bottom_header_row_close', 'sydney_reading_progress' ); } else { add_action( 'sydney_before_header_close', 'sydney_reading_progress' ); } add_action( 'sydney_before_mobile_header_close', 'sydney_reading_progress' ); } else { add_action( 'wp_footer', 'sydney_reading_progress' ); } } add_action( 'wp', 'sydney_reading_progress_position' ); /** * Reading Progress HTML output */ function sydney_reading_progress() { if( ! is_singular( 'post' ) ) { return; } $single_post_reading_progress = get_theme_mod( 'single_post_reading_progress', 0 ); if( ! $single_post_reading_progress ) { return; } $single_post_reading_progress_position = get_theme_mod( 'single_post_reading_progress_position', 'top' ); $single_post_reading_progress_comments = get_theme_mod( 'single_post_reading_progress_comments', 0 ); ?> <div id="sydney-reading-progress" class="sydney-reading-progress sydney-reading-progress-<?php echo esc_attr( $single_post_reading_progress_position ); ?>" data-inc-comments="<?php echo esc_attr( $single_post_reading_progress_comments ); ?>"> <div class="sydney-reading-progress__bar"></div> </div> <?php } /** * Updated date */ function sydney_updated_date() { if ( get_the_time( 'U' ) === get_the_modified_time( 'U' ) ) { return; } if ( is_single() ) { $before_text = get_theme_mod( 'before_updated_date_text' ); } else { $before_text = get_theme_mod( 'archive_before_updated_date_text' ); } $time_string = '<span class="sydney-updated-date">' . esc_html( $before_text ) . '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark"><time class="updated" datetime="' . get_the_modified_date( DATE_W3C ) . '" ' . sydney_get_schema( 'modified_date' ) . '>' . get_the_modified_date() . '</time></a></span>'; echo $time_string; }
[+]
..
[+]
breadcrumbs
[-] class-sydney-modules.php
[edit]
[-] class_sydney_archive_form_fields.php
[edit]
[-] ext-blog.php
[edit]
[-] ext-footer.php
[edit]
[-] quick-links.php
[edit]
[-] .htaccess.disabled
[edit]