'about', 'two' => 'service', 'three' => 'testimonials', 'four' => 'portfolio', 'five' => 'skills', 'six' => 'clients', 'seven' => 'pricing', 'eight' => 'action', 'nine' => 'team', 'ten' => 'blog' ); $section_template_data = array(); foreach($sections as $section => $value){ $section_enable_disable = get_theme_mod( 'section_'.$section.'_enable' , 1 ); if( !empty($section_enable_disable) && $section_enable_disable == 1 ){ $section_template_data[] = array( 'section-id' => $section, 'template-part' => $value, ); } } return $section_template_data; } function fortyseven_street_page_id( $value ){ $post = get_post($value); return $post; } //adding class to body boxed/full-width function fortyseven_street_bodyclass($classes){ $classes[]= get_theme_mod('webpage_layout','fullwidth'); return $classes; } add_filter('body_class','fortyseven_street_bodyclass' ); function fortyseven_street_sidebar_layout($classes){ global $post; if( is_404()){ $classes[] = ' '; } elseif(is_singular()){ $post_class = get_post_meta( $post -> ID, 'fortyseven_street_sidebar_layout', true ); if(empty($post_class)){ $post_class = 'right-sidebar'; $classes[] = $post_class; } else{ $post_class = get_post_meta( $post -> ID, 'fortyseven_street_sidebar_layout', true ); $classes[] = $post_class; } }else{ $classes[] = 'right-sidebar'; } return $classes; } add_filter('body_class', 'fortyseven_street_sidebar_layout'); function fortyseven_street_is_slider_active($classes){ if(is_front_page() || is_page_template('template-boxedhome.php') || is_page_template('template-header-layouts.php') ){ if( get_theme_mod('slider_option','1') != '1') { $classes[] = 'yes-slider'; }else{ $classes[] = 'no-slider'; } }else{ $classes[] = 'no-slider'; } return $classes; } add_filter('body_class', 'fortyseven_street_is_slider_active'); function fortyseven_street_get_attachment_id_from_url( $attachment_url = '' ) { global $wpdb; $attachment_id = false; // If there is no url, return. if ( '' == $attachment_url ) return; // Get the upload directory paths $upload_dir_paths = wp_upload_dir(); // Make sure the upload path base directory exists in the attachment URL, to verify that we're working with a media library image if ( false !== strpos( $attachment_url , $upload_dir_paths['baseurl'] ) ) { // If this is the URL of an auto-generated thumbnail, get the URL of the original image $attachment_url = preg_replace( '/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachment_url ); // Remove the upload path base directory from the attachment URL $attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url ); // Finally, run a custom database query to get the attachment ID from the modified attachment URL $attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) ); } return $attachment_id; } remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); function fortyseven_street_wrapper_start() { echo '