<?php
include get_template_directory().'/inc/functions-admin.php';

function vqode_script_enqueue()
{
    wp_enqueue_style('customstyle1', get_template_directory_uri() . '/css/custom.css', array(), '1.0.0', 'all');
    wp_enqueue_style('customstyle4', get_template_directory_uri() . '/css/bootstrap-reboot.css', array(), '1.0.0', 'all');
    wp_enqueue_style('customstyle5', get_template_directory_uri() . '/css/bootstrap-grid.css', array(), '1.0.0', 'all');
    wp_enqueue_style('customstyle6', get_template_directory_uri() . '/css/bootstrap.css', array(), '1.0.0', 'all');

    wp_enqueue_script('customjs1', get_template_directory_uri() . '/js/bootstrap.bundle.js', array(), '1.0.0', true);
    wp_enqueue_script('customjs2', get_template_directory_uri() . '/js/bootstrap.js', array(), '1.0.0', true);

}

add_action('wp_enqueue_scripts', 'vqode_script_enqueue');

function subscribe_hosting_shortcode() {
    ob_start();
    get_template_part('hosting');
    return ob_get_clean();
}
add_shortcode('subscribe-to-hosting', 'subscribe_hosting_shortcode');

add_action('init', 'do_output_buffer');
function do_output_buffer() {
    ob_start();
}


function vqode_theme_supports(){
    add_theme_support('menus');
    add_theme_support('custom-background');
    add_theme_support( 'post-thumbnails', array('post') );
   register_nav_menu('primary', 'Primary Header Navigation');
}

add_action('init', 'vqode_theme_supports');

$paged = ($_GET['paged'])? $_GET['paged'] : 1;
$args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 14, 'paged' => $paged);
query_posts($args);

function my_post_queries( $query ) {
    // do not alter the query on wp-admin pages and only alter it if it's the main query
    if (!is_admin() && $query->is_main_query()){

        // alter the query for the home and category pages

        if(is_home()){
            $query->set('posts_per_page', 14);
        }

        if(is_category()){
            $query->set('posts_per_page', 3);
        }

    }
}
add_action( 'pre_get_posts', 'my_post_queries' );
