';
$fields['email'] = '';
$fields['url'] = '';
return apply_filters( 'aces_comment_form_default_fields_markup', $fields );
}
}
add_filter( 'comment_form_default_fields', 'aces_comment_form_default_fields_markup' );
function my_update_comment_field( $comment_field ) {
$comment_field =
'';
return $comment_field;
}
add_filter( 'comment_form_field_comment', 'my_update_comment_field' );
/**
* Template for comments and pingbacks.
*/
if ( ! function_exists( 'aces_theme_comment' ) ) {
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own aces_theme_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
* @param string $comment Comment.
* @param array $args Comment arguments.
* @param number $depth Depth.
* @return mixed Comment markup.
*/
function aces_theme_comment( $comment, $args, $depth ) {
switch ( $comment->comment_type ) {
case 'pingback':
case 'trackback':
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), '//fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
if ( !function_exists( 'aces_secondary_fonts_url' ) ) :
/**
* Return Font's URL.
*
* @since 1.0.0
* @return string Fonts URL.
*/
function aces_secondary_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Merriweather, translate this to 'off'. Do not translate into your own language. */
if ('off' !== _x('on', 'Montserrat font: on or off', 'aces')) {
$fonts[] = 'Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
}
/* translators: If there are characters in your language that are not supported by Merriweather, translate this to 'off'. Do not translate into your own language. */
if ('off' !== _x('on', 'Montserrat font: on or off', 'aces')) {
$fonts[] = 'Montserrat:400,400i,600,600i,700,700i';
}
$fonts = array_unique( $fonts );
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), '//fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* Funtion To Get Google Fonts
*/
if ( !function_exists( 'aces_heading_fonts_url' ) ) :
/**
* Return Font's URL.
*
* @since 1.0.0
* @return string Fonts URL.
*/
function aces_heading_fonts_url() {
$font_family = get_theme_mod( 'aces_global_all_heading_font_family' );
if ( ! empty( $font_family ) ) {
$font = $font_family;
}else{
$font = 'Raleway';
}
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
$fonts[] = $font_family.':100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
$fonts = array_unique( $fonts );
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), '//fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* Return padding/margin values for customizer
*
* @since 1.4.9
*/
if ( ! function_exists( 'aces_spacing_css' ) ) {
function aces_spacing_css( $top, $right, $bottom, $left ) {
// Add px and 0 if no value
$s_top = ( isset( $top ) && '' !== $top ) ? intval( $top ) . 'px ' : '0px ';
$s_right = ( isset( $right ) && '' !== $right ) ? intval( $right ) . 'px ' : '0px ';
$s_bottom = ( isset( $bottom ) && '' !== $bottom ) ? intval( $bottom ) . 'px ' : '0px ';
$s_left = ( isset( $left ) && '' !== $left ) ? intval( $left ) . 'px' : '0px';
// Return one value if it is the same on every inputs
if ( ( intval( $s_top ) === intval( $s_right ) )
&& ( intval( $s_right ) === intval( $s_bottom ) )
&& ( intval( $s_bottom ) === intval( $s_left ) ) ) {
return $s_left;
}
// Return
return $s_top . $s_right . $s_bottom . $s_left;
}
}
/**
* Return padding/margin values for customizer
*
* @since 1.4.9
*/
if ( ! function_exists( 'aces_spacing_css_top_bottom' ) ) {
function aces_spacing_css_top_bottom( $top, $right, $bottom, $left ) {
// Add px and 0 if no value
$s_top = ( isset( $top ) && '' !== $top ) ? intval( $top ) . 'px ' : '40px ';
$s_bottom = ( isset( $bottom ) && '' !== $bottom ) ? intval( $bottom ) . 'px ' : '40px ';
$s_right = 'auto ';
$s_left = 'auto';
// Return
return $s_top . $s_right . $s_bottom . $s_left;
}
}
/**
* Minify CSS
*
* @since 1.0.0
*/
if ( ! function_exists( 'aces_minify_css' ) ) {
function aces_minify_css( $css = '' ) {
// Return if no CSS
if ( ! $css ) return;
// Normalize whitespace
$css = preg_replace( '/\s+/', ' ', $css );
// Remove ; before }
$css = preg_replace( '/;(?=\s*})/', '', $css );
// Remove space after , : ; { } */ >
$css = preg_replace( '/(,|:|;|\{|}|\*\/|>) /', '$1', $css );
// Remove space before , ; { }
$css = preg_replace( '/ (,|;|\{|})/', '$1', $css );
// Strips leading 0 on decimal values (converts 0.5px into .5px)
$css = preg_replace( '/(:| )0\.([0-9]+)(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}.${2}${3}', $css );
// Strips units if value is 0 (converts 0px to 0)
$css = preg_replace( '/(:| )(\.?)0(%|em|ex|px|in|cm|mm|pt|pc)/i', '${1}0', $css );
// Trim
$css = trim( $css );
// Return minified CSS
return $css;
}
}
/**
* Translation support
*
* @since 1.1.4
*/
if ( ! function_exists( 'aces_tm_translation' ) ) {
function aces_tm_translation( $id, $val = '' ) {
// Translate theme mod val
if ( $val ) {
// Polylang Translation
if ( function_exists( 'pll__' ) && $id ) {
$val = pll__( $val );
}
// Return the value
return $val;
}
}
}
/**
* Returns array of Social Options
*
* @since 1.0.0
*/
if ( ! function_exists( 'aces_social_option' ) ) {
function aces_social_option() {
return apply_filters( 'aces_social_option', array(
'twitter' => array(
'label' => esc_html__( 'Twitter', 'aces' ),
'icon_class' => 'fab fa-twitter',
),
'facebook' => array(
'label' => esc_html__( 'Facebook', 'aces' ),
'icon_class' => 'fab fa-facebook',
),
'googleplus' => array(
'label' => esc_html__( 'Google Plus', 'aces' ),
'icon_class' => 'fab fa-google-plus',
),
'pinterest' => array(
'label' => esc_html__( 'Pinterest', 'aces' ),
'icon_class' => 'fab fa-pinterest-p',
),
'dribbble' => array(
'label' => esc_html__( 'Dribbble', 'aces' ),
'icon_class' => 'fab fa-dribbble',
),
'vk' => array(
'label' => esc_html__( 'VK', 'aces' ),
'icon_class' => 'fab fa-vk',
),
'instagram' => array(
'label' => esc_html__( 'Instagram', 'aces' ),
'icon_class' => 'fab fa-instagram',
),
'linkedin' => array(
'label' => esc_html__( 'LinkedIn', 'aces' ),
'icon_class' => 'fab fa-linkedin',
),
'tumblr' => array(
'label' => esc_html__( 'Tumblr', 'aces' ),
'icon_class' => 'fab fa-tumblr',
),
'github' => array(
'label' => esc_html__( 'Github', 'aces' ),
'icon_class' => 'fab fa-github-alt',
),
'flickr' => array(
'label' => esc_html__( 'Flickr', 'aces' ),
'icon_class' => 'fab fa-flickr',
),
'skype' => array(
'label' => esc_html__( 'Skype', 'aces' ),
'icon_class' => 'fab fa-skype',
),
'youtube' => array(
'label' => esc_html__( 'Youtube', 'aces' ),
'icon_class' => 'fab fa-youtube',
),
'vimeo' => array(
'label' => esc_html__( 'Vimeo', 'aces' ),
'icon_class' => 'fab fa-vimeo-square',
),
'vine' => array(
'label' => esc_html__( 'Vine', 'aces' ),
'icon_class' => 'fab fa-vine',
),
'xing' => array(
'label' => esc_html__( 'Xing', 'aces' ),
'icon_class' => 'fab fa-xing',
),
'yelp' => array(
'label' => esc_html__( 'Yelp', 'aces' ),
'icon_class' => 'fab fa-yelp',
),
'tripadvisor' => array(
'label' => esc_html__( 'Tripadvisor', 'aces' ),
'icon_class' => 'fab fa-tripadvisor',
),
'rss' => array(
'label' => esc_html__( 'RSS', 'aces' ),
'icon_class' => 'fa fa-rss',
),
'email' => array(
'label' => esc_html__( 'Email', 'aces' ),
'icon_class' => 'fa fa-envelope',
),
) );
}
}
/**
* Returns blog entry elements positioning
*
* @since 1.1.0
*/
if ( ! function_exists( 'aces_blog_elements_positioning' ) ) {
function aces_blog_elements_positioning() {
// Default sections
$sections = array( 'title', 'categories', 'featured_image', 'content', 'meta', 'tags', 'read_more' );
// Get sections from Customizer
$sections = get_theme_mod( 'aces_blog_entry_elements_positioning', $sections );
// Turn into array if string
if ( $sections && ! is_array( $sections ) ) {
$sections = explode( ',', $sections );
}
// Apply filters for easy modification
$sections = apply_filters( 'aces_blog_entry_elements_positioning', $sections );
// Return sections
return $sections;
}
}
/**
* Get excerpt
*
* @since 1.5.6
*/
if ( ! function_exists( 'aces_excerpt' ) ) {
function aces_excerpt( $length = 35 ) {
global $post;
// Check for custom excerpt
if ( has_excerpt( $post->ID ) ) {
$output = $post->post_excerpt;
}
// No custom excerpt
else {
// Check for more tag and return content if it exists
if ( strpos( $post->post_content, '' ) ) {
$output = apply_filters( 'the_content', get_the_content() );
}
// No more tag defined
else {
$output = wp_trim_words( strip_shortcodes( $post->post_content ), $length );
}
}
return $output;
}
}
/**
* Get Footer widgets
*/
if ( ! function_exists( 'aces_get_footer_widget' ) ) {
/**
* Get Footer Default Sidebar
*
* @param string $sidebar_id Sidebar Id..
* @return void
*/
function aces_get_footer_widget( $sidebar_id ) {
if ( is_active_sidebar( $sidebar_id ) ) {
dynamic_sidebar( $sidebar_id );
} elseif ( current_user_can( 'edit_theme_options' ) ) {
global $wp_registered_sidebars;
$sidebar_name = '';
if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
$sidebar_name = $wp_registered_sidebars[ $sidebar_id ]['name'];
}
?>
max_num_pages;
$big = 999999999;
// Display pagination if total var is greater then 1 ( current query is paginated )
if ( $total > 1 ) {
// Get current page
if ( $current_page = get_query_var( 'paged' ) ) {
$current_page = $current_page;
} elseif ( $current_page = get_query_var( 'page' ) ) {
$current_page = $current_page;
} else {
$current_page = 1;
}
// Get permalink structure
if ( get_option( 'permalink_structure' ) ) {
if ( is_page() ) {
$format = 'page/%#%/';
} else {
$format = '/%#%/';
}
} else {
$format = '&paged=%#%';
}
$args = apply_filters( 'aces_pagination_args', array(
'base' => str_replace( $big, '%#%', html_entity_decode( get_pagenum_link( $big ) ) ),
'format' => $format,
'current' => max( 1, $current_page ),
'total' => $total,
'mid_size' => 3,
'type' => 'list',
'prev_text' => '',
'next_text' => '',
) );
// Output pagination
if ( $echo ) {
echo '';
} else {
return '';
}
}
}
}
if( ! function_exists( 'aces_main_menu_wrap' ) ) {
function aces_main_menu_wrap() {
$wrap = '';
$wrap .= '%3$s';
$wrap .= '
';
return $wrap;
}
}
if( ! function_exists( 'aces_nav_menu_add_classes' ) ) {
function aces_nav_menu_add_classes( $items, $args ) {
//Add first item class
$items[1]->classes[] = '';
//Add last item class
$i = count($items);
while($items[$i]->menu_item_parent != 0 && $i > 0) {
$i--;
}
$items[$i]->classes[] = 'drop-left';
return $items;
}
}
add_filter( 'wp_nav_menu_objects', 'aces_nav_menu_add_classes', 10, 2 );