esc_html__( 'Primary', 'all-purpose' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'all_purpose_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); } endif; add_action( 'after_setup_theme', 'all_purpose_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function all_purpose_content_width() { $GLOBALS['content_width'] = apply_filters( 'all_purpose_content_width', 640 ); } add_action( 'after_setup_theme', 'all_purpose_content_width', 0 ); /******************************* * Register widget area. ********************************/ function all_purpose_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'all-purpose' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'all-purpose' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'all_purpose_widgets_init' ); /******************************* * Enqueue scripts and styles. ********************************/ function all_purpose_scripts() { wp_enqueue_script('jquery'); wp_enqueue_style( 'all-purpose-style', get_stylesheet_uri()); wp_enqueue_style( 'all-purpose-animate', THEME_URI . '/framework/css/animate.css'); wp_enqueue_style( 'all-purpose-fontawesome', THEME_URI . '/framework/css/font-awesome.min.css' ); wp_enqueue_style( 'all-purpose-image-animation', THEME_URI . '/framework/admin/classes/testimonials/css/image-animation.css' ); wp_enqueue_style( 'all-purpose-genericons', THEME_URI . '/framework/genericons/genericons.css', array(), '3.4.1' ); wp_enqueue_style( 'all-purpose-woocommerce', THEME_URI . '/inc/woocommerce/woo-css.css' ); wp_enqueue_script( 'all-purpose-navigation', THEME_URI . '/framework/js/navigation.js', array(), '20120206', true ); wp_enqueue_script( 'all-purpose-skip-link-focus-fix', THEME_URI . '/framework/js/skip-link-focus-fix.js', array(), '20130115', true ); wp_enqueue_script( 'all-purpose-aniview', THEME_URI . '/framework/js/jquery.aniview.js' ); if ( is_singular() && wp_attachment_is_image() ) { wp_enqueue_script( 'all-purpose-keyboard-image-navigation', THEME_SCRIPTS_URI . '/keyboard-image-navigation.js', array( 'jquery' ), '20151104' ); } if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'all_purpose_scripts' ); /******************************* * Admin scripts and styles. ********************************/ function all_purpose_admin_scripts() { wp_enqueue_script('jquery'); wp_enqueue_media(); wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_style( 'all-purpose-options-css', ADMIN_URI . '/theme-options/css/theme-options.css' ); wp_enqueue_style( 'all-purpose-options-toggle', ADMIN_URI . '/theme-options/css/toggle.css' ); wp_enqueue_script( 'all-purpose-color-picker', ADMIN_URI.('/theme-options/js/color-picker.js'), array( 'wp-color-picker' ), false, true ); wp_enqueue_script( 'all-purpose-options-ui-js', ADMIN_URI . '/theme-options/js/ui.js' ); wp_enqueue_script( 'all-purpose-options-tabs-js', ADMIN_URI . '/theme-options/js/tabs.js' ); wp_enqueue_script( 'all-purpose-options-load-button', ADMIN_URI . '/theme-options/js/load-button.js' ); } add_action( 'admin_enqueue_scripts', 'all_purpose_admin_scripts' ); /******************************* * Includes. ********************************/ require THEME . '/inc/template-tags.php'; require THEME . '/inc/extras.php'; require THEME . '/inc/customizer.php'; require THEME . '/inc/jetpack.php'; /********************************************************************************************************* * Excerpt Read More **********************************************************************************************************/ function all_purpose_excerpt_more( $more ) { return '


' . all_purpose_return_read_more_text (). ''; } add_filter( 'excerpt_more', 'all_purpose_excerpt_more' ); function all_purpose_custom_excerpt_length( $length ) { if (get_option('all_purpose_read_more_lenght')) { return get_option('all_purpose_read_more_lenght'); } else return 42; } add_filter( 'excerpt_length', 'all_purpose_custom_excerpt_length', 999 ); function all_purpose_return_read_more_text () { if (get_option('all_purpose_read_more_text')) { return get_option('all_purpose_read_more_text'); } return "Read More"; } /********************************************************************************************************* * Sidebar Position **********************************************************************************************************/ $option_sidebar = get_option( 'option_sidebar'); if($option_sidebar == '1') { function all_purpose_sidebar() { $style_sidebar = wp_enqueue_style( 'right-sidebar', get_template_directory_uri() . '/framework/css/right-sidebar.css'); } add_action( 'wp_enqueue_scripts', 'all_purpose_sidebar' ); } if($option_sidebar == '3') { function all_purpose_sidebar() { $style_sidebar = wp_enqueue_style( 'no-sidebar', get_template_directory_uri() . '/framework/css/no-sidebar.css'); } add_action( 'wp_enqueue_scripts', 'all_purpose_sidebar' ); } /************************* Add JS in Head *************************/ if ( get_option('js_head') ) { function mn_js_add_head () { echo get_option( 'js_head' ); } add_action('wp_head', 'mn_js_add_head'); } /************************* Add JS in Footer *************************/ if ( get_option('js_footer') ) { function mn_js_add_footer(){ echo get_option( 'js_footer' ); } add_action('wp_footer','mn_js_add_footer'); } /********************************************************************************************************* * Pagination **********************************************************************************************************/ add_filter('wp_link_pages_args','all_purpose_add_next_and_number'); function all_purpose_add_next_and_number($args){ if($args['next_or_number'] == 'next_and_number'){ global $page, $numpages, $multipage, $more, $pagenow; $args['next_or_number'] = 'number'; $prev = ''; $next = ''; if ( $multipage ) { if ( $more ) { $i = $page - 1; if ( $i && $more ) { $prev .= _wp_link_page($i); $prev .= $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''; } $i = $page + 1; if ( $i <= $numpages && $more ) { $next .= _wp_link_page($i); $next .= $args['link_before']. $args['nextpagelink'] . $args['link_after'] . ''; } } } $args['before'] = $args['before'].$prev; $args['after'] = $next.$args['after']; } return $args; }