'', 'default-image' => '', 'default-repeat' => '', 'default-position-x' => '', 'default-attachment' => '', ); add_theme_support( 'custom-background', $defaults ); add_theme_support( 'custom-logo', array( 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ) ); add_theme_support('post-formats', array( 'link', 'gallery', 'quote', 'image', 'video', 'audio' ) ); // Adds support for a variety of post formats. add_action( 'wp_enqueue_scripts', 'writee_enqueue_styles' ); add_action( 'wp_enqueue_scripts', 'writee_enqueue_scripts' ); add_action( 'wp_enqueue_scripts', 'writee_custom_enqueue_script' ); add_image_size ( 'WRT-slider', 1600, 9999, false ); add_image_size ( 'WRT-post-image', 780, 9999, false ); remove_filter( 'the_content', 'wpautop' ); add_filter( 'the_content', 'wpautop' , 12); } /**********************************************/ ## Attach stylesheets /**********************************************/ function writee_enqueue_styles() { $writee_uri_path = get_template_directory_uri(); $writee_font_url = esc_attr(get_theme_mod('wrt_font_url')); wp_enqueue_style('WRT-style', $writee_uri_path . '/style.css', null, false, 'all'); if ( is_rtl() ) // if RTL language enabled. wp_enqueue_style('WRT-rtl-style', $writee_uri_path . '/assets/css/style-rtl.css', null, false, 'all'); else wp_enqueue_style('WRT-main-style', $writee_uri_path . '/assets/css/style-ltr.css', null, false, 'all'); if($writee_font_url != ''): wp_enqueue_style('WRT-google_fonts',$writee_font_url , null, false, 'all'); endif; } /** * Registers an editor stylesheet for the theme. */ function writee_add_editor_styles() { $writty_uri_path = get_template_directory_uri(); add_editor_style( $writty_uri_path . '/assets/css/admin/editor.css' ); } add_action( 'admin_init', 'writee_add_editor_styles' ); /********************************************/ ## Attach theme javascripts. /*******************************************/ function writee_enqueue_scripts() { $writee_uri_path = get_template_directory_uri(); wp_enqueue_script('WRT-pace', $writee_uri_path . '/assets/js/pace.min.js', array('jquery'), '1.0.0', true); wp_enqueue_script('WRT-modernizr', $writee_uri_path . '/assets/js/modernizr.js', array('jquery'), '1.0.0', true); wp_enqueue_script('WRT-cssua', $writee_uri_path . '/assets/js/cssua.min.js', array('jquery'), '1.0.0', true); wp_enqueue_script('WRT-carousel', $writee_uri_path . '/assets/js/slick.min.js', array('jquery'), '1.0.0', true); wp_enqueue_script('WRT-fitvids', $writee_uri_path . '/assets/js/jquery.fitvids.js', array('jquery'), '1.0.0', true); wp_enqueue_script('WRT-scrollUp', $writee_uri_path . '/assets/js/jquery.scrollUp.min.js', array('jquery'), '1.0.0', true); } /**************************************************/ ## body class filter. /**************************************************/ add_filter('body_class', 'writee_body_class' ); function writee_body_class($classes){ $classes[] = 'theme-header4'; return $classes; } add_filter('post_class', 'writee_post_class' ); function writee_post_class($classes) { $classes[] = 'entry entry-center'; return $classes; } /****************************************************/ ## Social icons list /****************************************************/ function writee_get_social($echo = true){ $link_enabled = 0; $social_link = ''; $writee_fb_link = esc_url(get_theme_mod('wrt_facebook')); $writee_twitter_link = esc_url(get_theme_mod('wrt_twitter')); $writee_insta_link = esc_url(get_theme_mod('wrt_instagram')); $writee_gplus_link = esc_url(get_theme_mod('wrt_googleplus')); $writee_linked_link = esc_url(get_theme_mod('wrt_linkedin')); $writee_ytube_link = esc_url(get_theme_mod('wrt_youtube')); $writee_pint_link = esc_url(get_theme_mod('wrt_pinterest')); $writee_drib_link = esc_url(get_theme_mod('wrt_dribble')); if($writee_fb_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_twitter_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_insta_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_gplus_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_linked_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_ytube_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_pint_link): $social_link .='
  • '; $link_enabled++; endif; if($writee_drib_link): $social_link .='
  • '; $link_enabled++; endif; $social_link_output = ''; $writee_button_style = esc_html(get_theme_mod('wrt_social_button_style', 'default-colors')); if($link_enabled > 0): $social_link_output .='
    '; endif; if($echo) echo $social_link_output; else return $social_link_output; } /***************************************************/ ## social share buttons. /***************************************************/ function writee_social_sharing_buttons() { global $post; // Show this on post only. if social shared enabled. // Get current page URL $shortURL = get_permalink(); // Get current page title $shortTitle = get_the_title(); // Construct sharing URL without using any script $twitterURL = esc_url('http://twitter.com/share?text='.$shortTitle.'&url='.$shortURL); $facebookURL = esc_url('https://www.facebook.com/sharer/sharer.php?u='.$shortURL); $googleURL = esc_url('https://plus.google.com/share?url='.$shortURL); //$bufferURL = 'https://bufferapp.com/add?url='.$shortURL.'&text='.$shortTitle; $pinterestURL = esc_url('http://pinterest.com/pin/create/button/?url='.$shortTitle.'&media='.$post->guid.'&description='.$shortTitle); // Add sharing button at the end of page/page content $content = ''; return $content; } /**************************************************/ ## pagination function /**************************************************/ function writee_pagenavi(){ the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => __( '← Previous', 'writee' ), 'next_text' => __( 'Next →', 'writee' ), ) ); } /****************************************************/ ## custom comments ping type call back function. /****************************************************/ function writee_comment_list( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : // 1 case 'trackback' : // 1 ?>
  • id="comment-">

    ', '' ); ?>

  • > %1$s %2$s', get_avatar( $comment, 120 ), ( $comment->user_id === $post->post_author ) ? '' . __( 'Post
    Author', 'writee' ) . '
    ' : '' ); ?>
    %1$s', get_comment_author_link() ); printf( '
    ', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), sprintf( __( '%1$s at %2$s', 'writee' ), get_comment_date(), get_comment_time() ) ); edit_comment_link( __( ' Edit', 'writee' ) ); ?>
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    comment_approved ) : ?>

    \',nextArrow : \'\',customPaging: function(slider, i) {return \'\' + (i + 1) + \'\';},cssEase: \'ease-in-out\', easing: \'ease-in-out\',lazyLoad: true, rtl: RTL,responsive: [{ breakpoint: 1200, settings: { slidesToShow: 1 }}]});});'); endif; } /***********************************************************/ ## excerpt filter /***********************************************************/ function writee_trim_excerpt($text) { return str_replace('[…]', '…', $text); } add_filter('excerpt_more', 'writee_trim_excerpt'); function writee_enqueue_comments_reply() { if( get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'comment_form_before', 'writee_enqueue_comments_reply' ); /** * Add a pingback url auto-discovery header for singularly identifiable articles. */ function writee_pingback_header() { if ( is_singular() && pings_open() ) { echo ''; } } add_action( 'wp_head', 'writee_pingback_header' ); ?>