esc_html__('Primary', 'abstract-grid'), )); /* * 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('abstract_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ))); } endif; add_action('after_setup_theme', 'abstract_grid_setup'); /** * Custom logo implementation **/ function abstract_grid_custom_logo_setup() { $defaults = array( 'height' => 100, 'width' => 100, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'site-title', 'site-description' ), ); add_theme_support( 'custom-logo', $defaults ); } add_action( 'after_setup_theme', 'abstract_grid_custom_logo_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. **/ function abstract_grid_content_width() { $GLOBALS['content_width'] = apply_filters('abstract_content_width', 640); } add_action('after_setup_theme', 'abstract_grid_content_width', 0); /** * Register widget area. */ function abstract_grid_widgets_init() { register_sidebar(array( 'name' => esc_html__('Footer One', 'abstract-grid'), 'id' => 'footer-1', 'description' => esc_html__('Add widgets here.', 'abstract-grid'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => esc_html__('Footer Two', 'abstract-grid'), 'id' => 'footer-2', 'description' => esc_html__('Add widgets here.', 'abstract-grid'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => esc_html__('Footer Three', 'abstract-grid'), 'id' => 'footer-3', 'description' => esc_html__('Add widgets here.', 'abstract-grid'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'abstract_grid_widgets_init'); /** * Enqueue scripts and styles. */ function abstract_grid_scripts() { wp_enqueue_style('abstract-grid-stylesheet', get_template_directory_uri() . '/style.css', array(), false, 'all'); wp_enqueue_style('abstract-grid-base-style', get_template_directory_uri() . '/css/base.css', array(), false, 'all'); wp_enqueue_style('abstract-grid-vendor-style', get_template_directory_uri() . '/css/vendor.css', array(), false, 'all'); wp_enqueue_style('abstract-grid-main-style', get_template_directory_uri() . '/css/main.css', array(), false, 'all'); wp_enqueue_style('abstract-grid-slick-nav', get_template_directory_uri() . '/css/slicknav.css', array(), false, 'all'); wp_enqueue_script('abstract-grid-modernizr-js', get_template_directory_uri() . '/js/modernizr.js', array(), '1.0', false); wp_enqueue_script('abstract-grid-pace-js', get_template_directory_uri() . '/js/pace.min.js', array(), '1.0', false); wp_enqueue_script('abstract-grid-plugins-js', get_template_directory_uri() . '/js/plugins.js', array('jquery'), '1.0', true); wp_enqueue_script('abstract-grid-slick-nav-js', get_template_directory_uri() . '/js/jquery.slicknav.js', array('jquery'), '', true); wp_enqueue_script('abstract-grid-main-js', get_template_directory_uri() . '/js/main.js', array('jquery'), '1.0', true); wp_enqueue_script('abstract-grid-navigation', get_template_directory_uri() . '/js/navigation.js', array('jquery'), '20151215', true); wp_enqueue_script('abstract-grid-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } } add_action('wp_enqueue_scripts', 'abstract_grid_scripts'); /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Redux Framework */ //require get_template_directory() . '/inc/metaboxes.php'; /** * Get the bootstrap! */ if ( file_exists( get_template_directory() . '/inc/CMB2/init.php' ) ) { require_once get_template_directory() . '/inc/CMB2/init.php'; } /** * Disable migrate js */ function abstract_dequeue_jquery_migrate( $scripts ) { if ( ! is_admin() && ! empty( $scripts->registered['jquery'] ) ) { $jquery_dependencies = $scripts->registered['jquery']->deps; $scripts->registered['jquery']->deps = array_diff( $jquery_dependencies, array( 'jquery-migrate' ) ); } } add_action( 'wp_default_scripts', 'abstract_dequeue_jquery_migrate' ); /** * custom class for drop down menu */ add_filter('nav_menu_css_class', 'abstract_grid_nav_class', 10, 2); function abstract_grid_nav_class($classes, $item) { if (in_array('current-menu-item', $classes)) { $classes[] = 'current '; } return $classes; } /** * Get content by ID */ function abstract_grid_get_limit_post_content($my_postid) { $content_post = get_post($my_postid); $content = $content_post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $the_str = substr($content, 0, 300); return $the_str; } /** * Get custom pagination */ function abstract_custom_pagination($numpages = '', $pagerange = '', $paged = '') { if (empty($pagerange)) { $pagerange = 2; } if (empty($paged)) { $paged = 1; } if ($numpages == '') { global $wp_query; $numpages = $wp_query->max_num_pages; if (!$numpages) { $numpages = 1; } } /** * We construct the pagination arguments to enter into our paginate_links * function. */ $pagination_args = array( 'base' => get_pagenum_link(1) . '%_%', 'format' => 'page/%#%', 'total' => $numpages, 'current' => $paged, 'show_all' => False, 'end_size' => 1, 'mid_size' => $pagerange, 'prev_next' => True, 'prev_text' => __('Prev', 'abstract-grid'), 'next_text' => __('Next', 'abstract-grid'), 'type' => 'plain', 'add_args' => false, 'add_fragment' => '' ); $paginate_links = paginate_links($pagination_args); if ($paginate_links) { echo "
"; } } /** * Enque admin script */ function abstract_grid_admin_enqueue($hook) { if ('post.php' == $hook || 'post-new.php' == $hook) { wp_enqueue_script('post-scripts', get_template_directory_uri() . '/js/admin-scripts.js'); } } add_action('admin_enqueue_scripts', 'abstract_grid_admin_enqueue'); /** * Post navigation (Single post at bottom) */ function abstract_grid_post_navigation($args = array()) { $args = wp_parse_args($args, array( 'prev_text' => '%title', 'next_text' => '%title', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category', 'screen_reader_text' => __('Post navigation', 'abstract-grid'), )); $navigation = ''; $previous = get_previous_post_link('
Previous %link
', $args['prev_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy']); $next = get_next_post_link('
Next %link
', $args['next_text'], $args['in_same_term'], $args['excluded_terms'], $args['taxonomy']); // Only add markup if there's somewhere to navigate to. if ($previous || $next) { $navigation = _navigation_markup(" ", 'post-navigation', $args['screen_reader_text']); } return $navigation; } /** * Move comment box bottom. */ function abstract_grid_move_comment_field_to_bottom($fields) { $comment_field = $fields['comment']; unset($fields['comment']); $fields['comment'] = $comment_field; return $fields; } add_filter('comment_form_fields', 'abstract_grid_move_comment_field_to_bottom'); /** * Change comment form textarea to use placeholder * */ function abstract_grid_comment_textarea_placeholder($args) { $args['comment_field'] = str_replace('textarea', 'textarea placeholder="' . __('Your Message *', 'abstract-grid') . '"', $args['comment_field']); return $args; } add_filter('comment_form_defaults', 'abstract_grid_comment_textarea_placeholder'); /** * Comment Form Fields Placeholder * */ function abstract_grid_comment_form_fields($fields) { foreach ($fields as & $field) { $field = str_replace('id="author"', 'id="author" placeholder="' . __('Your Name *', 'abstract-grid') . '"', $field); $field = str_replace('id="email"', 'id="email" placeholder="' . __('Your Email *', 'abstract-grid') . '"', $field); $field = str_replace('id="url"', 'id="url" placeholder="' . __('Website', 'abstract-grid') . '"', $field); } return $fields; } add_filter('comment_form_default_fields', 'abstract_grid_comment_form_fields'); /** * Change comment button */ function abstract_grid_comment_button() { echo ''; } add_action('comment_form', 'abstract_grid_comment_button'); /** * Custom comment Listing */ function abstract_grid_custom_comments($comment, $args, $depth) { switch ($comment->comment_type): case 'pingback': case 'trackback': ?>
  • id="comment">
  • id="comment-">
    class="comment">
    / __('Reply','abstract-grid'), 'depth' => $depth, 'max_depth' => $args['max_depth'] ))); ?>

    $count, 'category_name' => $category, 'post_type' => 'post', 'post_status' => 'publish', ); $posts = get_posts($args); return $posts; } /** * List all category */ function abstract_grid_all_category() { $all_cat = get_categories(); $cat_array = array(); if (is_array($all_cat)) { foreach ($all_cat as $cat) { $cat_array[$cat->slug] = $cat->name; } } return $cat_array; }