">
">
">
1, 'post_name' => $page, 'post_status' => 'publish' , 'post_title' => $page, 'post_type' => 'page', );
if($page== 'Home'):
$page_option = 'page_on_front';
$template = 'page-templates/frontpage.php';
else:
$page_option = 'page_for_posts';
$template = 'page.php';
endif;
$post_data = wp_insert_post( $post_data, false );
if ( $post_data ){
update_post_meta( $post_data, '_wp_page_template', $template );
$page = get_page_by_title($page);
update_option( 'show_on_front', 'page' );
update_option( $page_option, $page->ID );
}
}
update_option( 'fresh_site_activate', true );
}
}
fresh_site_activate();
/**
* Theme Comment Function
*/
if ( ! function_exists( 'arilewp_comment' ) ) :
function arilewp_comment( $comment, $args, $depth )
{
$GLOBALS['comment'] = $comment;
//get theme data
global $comment_data;
//translations
$leave_reply = $comment_data['translation_reply_to_coment'] ? $comment_data['translation_reply_to_coment'] :
__('Reply','arilewp');?>
ID}\" class=\"more-link\">" .esc_html__('Read More','arilewp')."";
}
add_filter( 'the_content_more_link', 'arilewp_read_more_button_class' );
function arilewp_post_thumbnail() {
if(has_post_thumbnail()){
echo '';
the_post_thumbnail( '', array( 'class'=>'img-fluid' ) );
echo '';
}
}
/**
* Theme Page Header Title
*/
function arilewp_theme_page_header_title(){
$arilewp_page_header_layout = get_theme_mod('arilewp_page_header_layout', 'arilewp_page_header_layout1');
if($arilewp_page_header_layout == 'arilewp_page_header_layout1'):
$page_title_class = 'text-center';
else: $page_title_class = '';
endif;
if( is_archive() )
{
echo '';
}
elseif( is_404() )
{
echo '';
}
elseif( is_search() )
{
echo '';
}
else
{
echo '';
}
}
function arilewp_bootstrap_menu_notitle( $menu ){
return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu );
}
add_filter( 'wp_nav_menu', 'arilewp_bootstrap_menu_notitle' );
/**
* Theme Breadcrumbs Url
*/
function arilewp_page_url() {
$page_url = 'http';
if ( key_exists("HTTPS", $_SERVER) && ( $_SERVER["HTTPS"] == "on" ) ){
$page_url .= "s";
}
$page_url .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $page_url;
}
/**
* Theme Breadcrumbs
*/
if( !function_exists('arilewp_page_header_breadcrumbs') ):
function arilewp_page_header_breadcrumbs() {
global $post;
$homeLink = home_url();
$arilewp_page_header_layout = get_theme_mod('arilewp_page_header_layout', 'arilewp_page_header_layout1');
if($arilewp_page_header_layout == 'arilewp_page_header_layout1'):
$breadcrumb_class = 'text-center';
else: $breadcrumb_class = 'text-right';
endif;
echo '';
if (is_home() || is_front_page()) :
echo '- '.__('Home','arilewp').'
';
echo '- '; echo single_post_title(); echo '
';
else:
echo '- '.__('Home','arilewp').'
';
if ( is_category() ) {
echo '- ' . __('Archive by category','arilewp').' "' . single_cat_title('', false) . '"
';
} elseif ( is_day() ) {
echo '- '. get_the_time('Y') .'';
echo '
- '. get_the_time('F') .'';
echo '
- '. get_the_time('d') .'
';
} elseif ( is_month() ) {
echo '- ' . get_the_time('Y') . '';
echo '
- '. get_the_time('F') .'
';
} elseif ( is_year() ) {
echo '- '. get_the_time('Y') .'
';
} elseif ( is_single() && !is_attachment() && is_page('single-product') ) {
if ( get_post_type() != 'post' ) {
$cat = get_the_category();
$cat = $cat[0];
echo '- ';
echo get_category_parents($cat, TRUE, '');
echo '
';
echo '- '. wp_title( '',false ) .'
';
} }
elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '- ' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo $crumb;
echo '
- '. get_the_title() .'
';
}
elseif( is_search() )
{
echo '- '. get_search_query() .'
';
}
elseif( is_404() )
{
echo '- '.__('Error 404','arilewp').'
';
}
else {
echo '- '. get_the_title() .'
';
}
endif;
echo '
';
}
endif;
/*
* Import customizer options from Lite version
*/
add_action( 'after_switch_theme', 'arilewp_merge_lite_options' );
/**
* Import lite options.
*/
function arilewp_merge_lite_options() {
$arilewp_mods = get_option( 'theme_mods_arilewp' );
if ( ! empty( $arilewp_mods ) ) {
foreach ( $arilewp_mods as $arilewp_mod_k => $arilewp_mod_v ) {
set_theme_mod( $arilewp_mod_k, $arilewp_mod_v );
}
}
}
add_action( 'after_switch_theme', 'arilewp_import_theme_mods_from_child_theme_to_pro_theme' );
/**
* Import theme options from child theme to ArileWP Pro theme
*/
function arilewp_import_theme_mods_from_child_theme_to_pro_theme() {
// Get the name of the previously active theme.
$previous_theme = strtolower( get_option( 'theme_switched' ) );
if ( ! in_array(
$previous_theme, array(
'business-street',
'strangerwp',
'newyork-city',
'arilewp-child-theme',
)
) ) {
return;
}
// Get the theme mods from the previous theme.
$previous_theme_content = get_option( 'theme_mods_' . $previous_theme );
if ( ! empty( $previous_theme_content ) ) {
foreach ( $previous_theme_content as $previous_theme_mod_k => $previous_theme_mod_v ) {
set_theme_mod( $previous_theme_mod_k, $previous_theme_mod_v );
}
}
}
/**
* Import lite project options.
*/
$merge_project_lite_options = get_option( 'merge_project_lite_options' , 'lite');
$arilewp_project_content = get_theme_mod( 'arilewp_project_content');
if ( ! empty( $arilewp_project_content ) ) {
if ( $merge_project_lite_options === 'lite' ) {
$allowed_html = array('br' => array(), 'em' => array(), 'strong' => array(), 'b' => array(),'i' => array());
$arilewp_project_content = json_decode($arilewp_project_content);
foreach ( $arilewp_project_content as $project_item ) {
$image_url = ! empty( $project_item->image_url ) ? $project_item->image_url : '';
$title = ! empty( $project_item->title ) ? $project_item->title : '';
$text = ! empty( $project_item->text ) ? $project_item->text : '';
if(!empty($title)){
$post_id = wp_insert_post(
array (
'post_type' => 'arilewp_portfolio',
'post_title' => $title,
'post_status' => 'publish',
));
$filename = $image_url;
$filetype = wp_check_filetype( basename( $filename ), null );
$wp_upload_dir = wp_upload_dir();
$attachment = array(
'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ),
'post_mime_type' => $filetype['type'],
'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment( $attachment, $filename, $post_id );
set_post_thumbnail( $post_id, $attach_id );
update_post_meta($post_id, 'custom_portfolio_description', sanitize_text_field($text));
$table_name = $wpdb->prefix . "term_relationships";
$wpdb->insert($table_name, array('object_id' => $post_id, 'term_taxonomy_id' => 2 ,'term_order' => 0) );
}
}
update_option( 'merge_project_lite_options', 'update' );
}
}
/**
* Blog Masonry
*/
function arilewp_custom_script()
{
wp_reset_query();
$col =6;
if(is_page_template('page-templates/blog-masonry-2-col.php'))
{ $col =6; }
elseif(is_page_template('page-templates/blog-masonry-3-col.php'))
{ $col =4; }
elseif(is_page_template('page-templates/blog-masonry-4-col.php'))
{ $col =3; }
?>
body.theme-boxed{ background:url("'.ARILEWP_PARENT_INC_ICON_URI.'/'.$theme_boxed_image.'.'.$image_format.'") repeat fixed;}';
}
}
add_action('wp_head','arilewp_background_image',10,0);
/**
* Add object term default
*/
function arilewp_default_object_terms( $post_id, $post ) {
if ( 'publish' === $post->post_status && $post->post_type === 'arilewp_portfolio' ) {
$defaults = array( 'portfolio_categories' => array( 'Show All' ) );
$taxonomies = get_object_taxonomies( $post->post_type );
foreach ( (array) $taxonomies as $taxonomy ) {
$terms = wp_get_post_terms( $post_id, $taxonomy );
if ( empty( $terms ) && array_key_exists( $taxonomy, $defaults ) ) {
wp_set_object_terms( $post_id, $defaults[$taxonomy], $taxonomy );
}
}
}
}
add_action( 'save_post', 'arilewp_default_object_terms', 0, 2 );
/**
* Custom Theme Script
*/
function arilewp_custom_owl_theme_scripts() {
$arilewp_main_slider_aniamte_type = get_theme_mod('arilewp_main_slider_aniamte_type', 'slide');
if($arilewp_main_slider_aniamte_type == 'fade'):
$arilewp_main_slider_aniamte_in = 'fadeIn'; $arilewp_main_slider_aniamte_out = 'fadeOut';
else:
$arilewp_main_slider_aniamte_in = ''; $arilewp_main_slider_aniamte_out = '';
endif;
$arilewp_main_slider_scroll_speed = get_theme_mod('arilewp_main_slider_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
$arilewp_main_slider_smart_speed = get_theme_mod('arilewp_main_slider_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
$arilewp_main_slider_mouse_drag_disabled = get_theme_mod('arilewp_main_slider_mouse_drag_disabled', true);
$arilewp_project_scroll_speed = get_theme_mod('arilewp_project_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
$arilewp_project_smart_speed = get_theme_mod('arilewp_project_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
$arilewp_project_mouse_drag_disabled = get_theme_mod('arilewp_project_mouse_drag_disabled', true);
$arilewp_project_column_layout = get_theme_mod('arilewp_project_column_layout', '4');
$arilewp_testimonial_scroll_speed = get_theme_mod('arilewp_testimonial_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
$arilewp_testimonial_smart_speed = get_theme_mod('arilewp_testimonial_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
$arilewp_testimonial_mouse_drag_disabled = get_theme_mod('arilewp_testimonial_mouse_drag_disabled', true);
$arilewp_testimonial_column_layout = get_theme_mod('arilewp_testimonial_column_layout', '3');
$arilewp_wooshop_scroll_speed = get_theme_mod('arilewp_wooshop_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
$arilewp_wooshop_smart_speed = get_theme_mod('arilewp_wooshop_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
$arilewp_wooshop_mouse_drag_disabled = get_theme_mod('arilewp_wooshop_mouse_drag_disabled', true);
$arilewp_wooshop_column_layout = get_theme_mod('arilewp_wooshop_column_layout', '4');
$arilewp_team_scroll_speed = get_theme_mod('arilewp_team_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
$arilewp_team_smart_speed = get_theme_mod('arilewp_team_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
$arilewp_team_mouse_drag_disabled = get_theme_mod('arilewp_team_mouse_drag_disabled', true);
$arilewp_team_column_layout = get_theme_mod('arilewp_team_column_layout', '3');
$arilewp_client_scroll_speed = get_theme_mod('arilewp_client_scroll_speed', array('slider' => 2500,'suffix' => 'ms',));
$arilewp_client_smart_speed = get_theme_mod('arilewp_client_smart_speed', array('slider' => 1000,'suffix' => 'ms',));
$arilewp_client_mouse_drag_disabled = get_theme_mod('arilewp_client_mouse_drag_disabled', true);
$arilewp_client1_column_layout = get_theme_mod('arilewp_client1_column_layout', '5');
$custom_data = array(
'arilewp_main_slider_aniamte_in' => $arilewp_main_slider_aniamte_in,
'arilewp_main_slider_aniamte_out' => $arilewp_main_slider_aniamte_out,
'arilewp_main_slider_scroll_speed' => $arilewp_main_slider_scroll_speed['slider'],
'arilewp_main_slider_smart_speed' => $arilewp_main_slider_smart_speed['slider'],
'arilewp_main_slider_mouse_drag_disabled' => $arilewp_main_slider_mouse_drag_disabled,
'arilewp_project_scroll_speed' => $arilewp_project_scroll_speed['slider'],
'arilewp_project_smart_speed' => $arilewp_project_smart_speed['slider'],
'arilewp_project_mouse_drag_disabled' => $arilewp_project_mouse_drag_disabled,
'arilewp_project_column_layout' => $arilewp_project_column_layout,
'arilewp_testimonial_scroll_speed' => $arilewp_testimonial_scroll_speed['slider'],
'arilewp_testimonial_smart_speed' => $arilewp_testimonial_smart_speed['slider'],
'arilewp_testimonial_mouse_drag_disabled' => $arilewp_testimonial_mouse_drag_disabled,
'arilewp_testimonial_column_layout' => $arilewp_testimonial_column_layout,
'arilewp_wooshop_scroll_speed' => $arilewp_wooshop_scroll_speed['slider'],
'arilewp_wooshop_smart_speed' => $arilewp_wooshop_smart_speed['slider'],
'arilewp_wooshop_mouse_drag_disabled' => $arilewp_wooshop_mouse_drag_disabled,
'arilewp_wooshop_column_layout' => $arilewp_wooshop_column_layout,
'arilewp_team_scroll_speed' => $arilewp_team_scroll_speed['slider'],
'arilewp_team_smart_speed' => $arilewp_team_smart_speed['slider'],
'arilewp_team_mouse_drag_disabled' => $arilewp_team_mouse_drag_disabled,
'arilewp_team_column_layout' => $arilewp_team_column_layout,
'arilewp_client_scroll_speed' => $arilewp_client_scroll_speed['slider'],
'arilewp_client_smart_speed' => $arilewp_client_smart_speed['slider'],
'arilewp_client_mouse_drag_disabled' => $arilewp_client_mouse_drag_disabled,
'arilewp_client1_column_layout' => $arilewp_client1_column_layout,
);
wp_register_script('arilewp-custom',get_template_directory_uri().'/assets/js/custom.js',array('jquery'));
wp_localize_script('arilewp-custom','custom_data',$custom_data);
wp_enqueue_script('arilewp-custom');
}
add_action( 'wp_enqueue_scripts', 'arilewp_custom_owl_theme_scripts' );
/**
* Theme Pagination Class.
*/
class Class_ArileWP_Theme_Pagination
{
function arilewp_pagination()
{
global $post;
global $wp_query, $wp_rewrite,$loop;
if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } else { $paged = 1; }
if($wp_query->max_num_pages==0){ $wp_query = $loop; }
?>
$field_value ) {
if ( $field_value !== 'undefined' ) {
if ( $field_name !== 'id' ) {
$f_n = ucfirst( $field_name );
pll_register_string( $f_n, $field_value);
}
}
}
}
}
}
/**
* Top Header Info
*/
function arilewp_top_header_info_register_strings() {
arilewp_pll_string_register( 'arilewp_top_header_info_content', 'Theme Header Info' );
}
/**
* Top Header Social Icon
*/
function arilewp_top_header_social_register_strings() {
arilewp_pll_string_register( 'arilewp_top_header_social_content', 'Theme Header Social' );
}
/**
* Theme Info
*/
function arilewp_theme_info_register_strings() {
arilewp_pll_string_register( 'arilewp_theme_info_content', 'Theme Info Area' );
}
/**
* Main Slider.
*/
function arilewp_main_slider_register_strings() {
arilewp_pll_string_register( 'arilewp_main_slider_content', 'Theme Slider' );
}
/**
* Service
*/
function arilewp_service_register_strings() {
arilewp_pll_string_register( 'arilewp_service_content', 'Theme Service' );
}
/**
* Funfact
*/
function arilewp_funfact_register_strings() {
arilewp_pll_string_register( 'arilewp_funfact_content', 'Theme Funfact' );
}
/**
* Testimonial
*/
function arilewp_testimonial_register_strings() {
arilewp_pll_string_register( 'arilewp_testimonial_content', 'Theme Testimonial' );
}
/**
* Team
*/
function arilewp_team_register_strings() {
arilewp_pll_string_register( 'arilewp_team_content', 'Theme Team' );
}
/**
* Client
*/
function arilewp_clients_register_strings() {
arilewp_pll_string_register( 'arilewp_clients_content', 'Theme Client' );
}
/**
* Contact Info
*/
function arilewp_contact_template_info_register_strings() {
arilewp_pll_string_register( 'arilewp_contact_template_info_content', 'Theme Contact Info' );
}
/**
* Pll register
*/
if ( function_exists( 'pll_register_string' ) ) {
add_action( 'after_setup_theme', 'arilewp_top_header_info_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_top_header_social_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_theme_info_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_main_slider_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_service_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_funfact_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_testimonial_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_team_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_clients_register_strings', 11 );
add_action( 'after_setup_theme', 'arilewp_contact_template_info_register_strings', 11 );
}