';
if ( $has_left_sidebar ) {
alpus_get_template_part( 'sidebar', null, array( 'position' => 'left' ) );
}
if ( $has_right_sidebar ) {
alpus_get_template_part( 'sidebar', null, array( 'position' => 'right' ) );
}
/**
* Fires after print sidebar.
*
* @since 1.0
*/
do_action( 'alpus_sidebar' );
/**
* Filters the main content class.
*
* @since 1.0
*/
echo '
';
/**
* Fires before print inner content.
*
* @since 1.0
*/
do_action( 'alpus_before_inner_content' );
}
}
/**
* Print layout after.
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_print_layout_after' ) ) {
function alpus_print_layout_after() {
$ls = false; // state of left sidebar
$rs = false; // state of right sidebar
$ls_canvas = false; // on_canvas/off_canvas
$rs_canvas = false; // on_canvas/off_canvas
global $alpus_layout;
/**
* Fires after print inner content.
*
* @since 1.0
*/
do_action( 'alpus_after_inner_content', $alpus_layout );
echo '
'; // End of main content wrap
/**
* Fires after rendering main content.
*
* @since 1.0
*/
do_action( 'alpus_after_main_content' );
echo '
';
if ( is_page() && ! alpus_is_shop() && comments_open() ) {
comments_template();
}
if ( isset( $alpus_layout['wrap'] ) && 'full' != $alpus_layout['wrap'] ) { // end of container or container-fluid
echo '';
}
}
}
/**
* The comment form before fields.
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_comment_form_before_fields' ) ) {
function alpus_comment_form_before_fields() {
echo '';
}
}
/**
* The comment form after fields.
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_comment_form_after_fields' ) ) {
function alpus_comment_form_after_fields() {
echo '
';
}
}
/**
* Set avatar size.
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_set_avatar_size' ) ) {
function alpus_set_avatar_size( $args ) {
$args['size'] = 90;
$args['width'] = 90;
$args['height'] = 90;
return $args;
}
}
/**
* The author date pattern.
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_author_date_pattern' ) ) {
function alpus_author_date_pattern( $date ) {
return date( 'F j, Y \a\t g:s a', strtotime( $date ) );
}
}
/**
* Set cookies.
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_set_cookies' ) ) {
function alpus_set_cookies() {
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( ! empty( $_GET['top_filter'] ) ) {
setcookie( 'top_filter', sanitize_title( $_GET['top_filter'] ), time() + ( 86400 ), '/' );
$_COOKIE['alpus_top_filter'] = esc_html( $_GET['top_filter'] );
}
// phpcs:enable
}
}
/**
* Ajax actions: loadmore
*
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_loadmore' ) ) {
function alpus_loadmore() {
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
if ( isset( $_POST['args'] ) && isset( $_POST['props'] ) ) {
$args = $_POST['args'];
$props = $_POST['props'];
$cpt = empty( $args['cpt'] ) ? 'post' : $args['cpt'];
$shortcode = empty( $props['shortcode'] ) ? '' : $props['shortcode'];
if ( 'alpus-posts-grid' == $shortcode ) {
$atts = $props;
if ( ! empty( $args['paged'] ) ) {
if ( is_front_page() ) {
set_query_var( 'page', (int) $args['paged'] );
} else {
set_query_var( 'paged', (int) $args['paged'] );
}
}
if ( ! empty( $args['category'] ) && '*' != $args['category'] ) {
$atts['cats'] = sanitize_text_field( $args['category'] );
}
require alpus_core_framework_path( ALPUS_CORE_FRAMEWORK_PATH . '/widgets/posts-grid/render-posts-grid.php' );
} elseif ( 'product' == $cpt ) {
/**
* Load more products
*/
if ( isset( $args['paged'] ) && $args['paged'] ) {
$args['page'] = $args['paged'];
unset( $args['paged'] );
}
if ( isset( $args['total'] ) && $args['total'] ) {
unset( $args['total'] );
}
if ( isset( $props['row_cnt'] ) ) {
$GLOBALS['alpus_current_product_id'] = 0;
}
wc_set_loop_prop( 'alpus_ajax_load', true );
foreach ( $props as $key => $prop ) {
wc_set_loop_prop( $key, $prop );
}
$args_str = '';
foreach ( $args as $key => $value ) {
if ( 'posts_per_page' == $key ) {
$key = 'limit';
}
$args_str .= ' ' . $key . '=' . json_encode( $value );
}
$html = do_shortcode( '[products' . $args_str . ']' );
echo alpus_escaped( $html );
} else {
/**
* Load more posts
*/
$posts = new WP_Query( $args );
if ( $posts ) {
ob_start();
/**
* Fires before archive posts widget render.
*
* @since 1.0
*/
do_action( 'alpus_before_posts_loop', $props );
alpus_get_template_part( 'posts/post', 'loop-start' );
while ( $posts->have_posts() ) :
$posts->the_post();
alpus_get_template_part( 'posts/post' );
endwhile;
alpus_get_template_part( 'posts/post', 'loop-end' );
/**
* Fires after archive posts widget render.
*
* @since 1.0
*/
do_action( 'alpus_after_posts_loop' );
$html = ob_get_clean();
if ( $_POST['pagination'] ) {
echo json_encode(
array(
'html' => $html,
'pagination' => alpus_get_pagination( $posts, 'pagination-load' ),
)
);
} else {
echo alpus_escaped( $html );
}
wp_reset_postdata();
}
}
}
exit;
// phpcs:enable
}
}
/**
* Ajax sign in/ sign up
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_retrieve_account_html' ) ) {
function alpus_retrieve_account_html() {
?>
trim( $_POST['username'] ),
'user_password' => $_POST['password'],
'remember' => isset( $_POST['rememberme'] ),
);
$validation_error = new WP_Error();
$validation_error = apply_filters( $filter_prefix . '_process_login_errors', $validation_error, $_POST['username'], $_POST['password'] );
if ( $validation_error->get_error_code() ) {
echo json_encode(
array(
'loggedin' => false,
'message' => '
1 ) {
?>
$menu,
'container' => 'nav',
'container_class' => $menu,
'items_wrap' => '',
'walker' => class_exists( 'Alpus_Walker_Nav_Menu' ) ? new Alpus_Walker_Nav_Menu() : new Walker_Nav_Menu(),
'theme_location' => '',
)
);
}
}
?>
'nav',
'container_class' => '',
'items_wrap' => '',
'walker' => class_exists( 'Alpus_Walker_Nav_Menu' ) ? new Alpus_Walker_Nav_Menu() : new Walker_Nav_Menu(),
'theme_location' => 'main-menu',
)
);
?>
$menu,
'container' => '',
'items_wrap' => '%3$s',
'walker' => class_exists( 'Alpus_Walker_Nav_Menu' ) ? new Alpus_Walker_Nav_Menu() : new Walker_Nav_Menu(),
'echo' => false,
)
);
}
echo json_encode( $result );
}
}
exit;
// phpcs:enable
}
}
/**
* Alpus Contact Form Functions
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_wpcf7_add_form_tag_submit' ) ) {
function alpus_wpcf7_add_form_tag_submit() {
wpcf7_remove_form_tag( 'submit' );
wpcf7_add_form_tag( 'submit', 'alpus_wpcf7_submit_form_tag_handler' );
}
}
if ( ! function_exists( 'alpus_wpcf7_submit_form_tag_handler' ) ) {
function alpus_wpcf7_submit_form_tag_handler( $tag ) {
$class = wpcf7_form_controls_class( $tag->type );
$atts = array();
$atts['class'] = $tag->get_class_option( $class );
$atts['id'] = $tag->get_id_option();
$atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true );
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
if ( empty( $value ) ) {
$value = esc_html__( 'Send', 'alpus' );
}
$atts['type'] = 'submit';
$atts['value'] = $value;
$atts = wpcf7_format_atts( $atts );
$html = sprintf( '
', $atts, esc_html( $value ) );
return $html;
}
}
function alpus_wpcf7_form_novalidate() {
return '';
}
/**
* Alpus Widget Compatability Functions
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_widget_nav_menu_args' ) ) {
function alpus_widget_nav_menu_args( $nav_menu_args, $menu, $args, $instance ) {
$nav_menu_args['items_wrap'] = '';
return $nav_menu_args;
}
}
/**
* The image quality
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_set_image_quality' ) ) {
function alpus_set_image_quality() {
return alpus_get_option( 'image_quality', 82 );
}
}
/**
* The big image size Threshold
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_set_big_image_size_threshold' ) ) {
function alpus_set_big_image_size_threshold() {
return alpus_get_option( 'big_image_threshold', 2560 );
}
}
/**
* The comment feeling
*
* @since 1.0
*/
if ( ! function_exists( 'alpus_ajax_comment_feeling' ) ) {
function alpus_ajax_comment_feeling() {
// check_ajax_referer( 'alpus-nonce', 'nonce' );
// phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
$id = isset( $_POST['comment_id'] ) ? $_POST['comment_id'] : 0;
if ( $id ) {
$action = $_POST['button'];
$status = isset( $_COOKIE[ 'alpus_comment_feeling_' . $id ] ) ? (int) $_COOKIE[ 'alpus_comment_feeling_' . $id ] : 0;
$like_count = get_comment_meta( $id, 'like_count', true );
$dislike_count = get_comment_meta( $id, 'dislike_count', true );
if ( 'like' == $action ) {
if ( 1 == $status ) {
-- $like_count;
$status = 0;
} else {
if ( -1 == $status ) {
-- $dislike_count;
}
++ $like_count;
$status = 1;
}
} else {
if ( -1 == $status ) {
-- $dislike_count;
$status = 0;
} else {
if ( 1 == $status ) {
-- $like_count;
}
++ $dislike_count;
$status = -1;
}
}
$like_count = max( 0, $like_count );
$dislike_count = max( 0, $dislike_count );
if ( $status ) {
setcookie( 'comment_feeling_' . intval( $id ), $status, time() + 360 * 24 * 60 * 60, '/' );
} else {
setcookie( 'comment_feeling_' . intval( $id ), '', time() - 360 * 24 * 60 * 60, '/' );
}
update_comment_meta( $id, 'like_count', $like_count );
update_comment_meta( $id, 'dislike_count', $dislike_count );
echo json_encode( array( $status, intval( $like_count ), intval( $dislike_count ) ) );
}
// phpcs:enable
exit();
}
}
if ( ! function_exists( 'alpus_comment_form_args' ) ) {
/**
* Set comment form arguments
*
* @since 1.0
*/
function alpus_comment_form_args( $args ) {
$args['title_reply_before'] = '';
$args['fields']['author'] = '
';
$args['fields']['email'] = '
';
$args['comment_field'] = isset( $args['comment_field'] ) ? $args['comment_field'] : '';
$args['comment_field'] = substr( $args['comment_field'], 0, strpos( $args['comment_field'], '