Powered By Blogger

Tuesday, July 7, 2015

functions.php

<?php
/*Bootstrap js register
================================================== */

function wpbootstrap_scripts_with_jquery()
{
// Register the script like this for a theme:
wp_register_script( 'custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array( 'jquery' ) );
// For either a plugin or a theme, you can then enqueue the script:
wp_enqueue_script( 'custom-script' );
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );

/*Register Menu
================================================== */
function register_my_menus() {
  register_nav_menus(
    array(
      'header-menu' => __( 'Header Menu' ),
      'extra-menu' => __( 'Extra Menu' )
    )
  );
}
add_action( 'init', 'register_my_menus' );

/* Register our sidebars and widgetized areas.
================================================== */
function arphabet_widgets_init() {

register_sidebar( array(
'name' => 'sidebar',
'id' => 'home_right_1',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="rounded">',
'after_title' => '</h2>',
) );

}
add_action( 'widgets_init', 'arphabet_widgets_init' );

/* Register Footer in widget areas.
================================================== */
if ( function_exists('register_sidebar') )
{
register_sidebars(2, array('name'=>'Footer %d')); }

/* Register featuered image for post,page,custom post work,custom post Team,
================================================== */
//add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails', array( 'post', 'page', 'article', 'dp_work','partnerswork','dp_team' ) );

/* Register theme option
================================================== */

function setup_theme_admin_menus() {
    add_submenu_page('themes.php',  
        'Theme Page Elements', 'Theme Option', 'manage_options',  
        'theme-page-elements', 'theme_option_page_settings');  
}
function theme_option_page_settings() {
    echo "Hello, world!";
}
add_action("admin_menu", "setup_theme_admin_menus");


function register_my_setting() {
register_setting( 'theme_options_group', 'theme_option_name', 'Theme_option' );
}
add_action( 'admin_init', 'register_my_setting' );

/* Register Custom post type Work
================================================== */
add_action( 'init', 'create_posttype' );
function create_posttype() {
  register_post_type( 'dp_work',
    array(
      'labels' => array(
        'name' => __( 'Works' ),
        'singular_name' => __( 'Work' ),
        'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New Work' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit Work' ),
'new_item' => __( 'New Work' ),
'view' => __( 'View Work' ),
'view_item' => __( 'View Work' ),
'search_items' => __( 'Search Work' ),
'not_found' => __( 'No books found' ),
'not_found_in_trash' => __( 'No books found in Trash' ),
'parent' => __( 'Parent Work' )
      ),
      'public' => true,
      'has_archive' => true,
      'supports' => array('title', 'editor', 'thumbnail','custom-fields'),
      'taxonomies' => array('category', 'post_tag'),
      'rewrite' => array('slug' => 'works'),
     
    )
  );
}


function my_rewrite_flush() {
    flush_rewrite_rules();
}
add_action( 'after_switch_theme', 'my_rewrite_flush' );

/*  Custom wp-login
================================================== */
function theme_customize_login() {
?>
    <link rel="stylesheet" href="<?php echo get_bloginfo( 'stylesheet_directory' ) . '/style.css'; ?>" type="text/css" media="all" />
<?php
}
add_action( 'login_enqueue_scripts', 'theme_customize_login' );

/*  excerpt
================================================== */
function custom_excerpt_length( $length ) {
  return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );


/* Register Custom post type Team
================================================== */
add_action( 'init', 'create_post_type' );
function create_post_type() {
  register_post_type( 'dp_team',
    array(
      'labels' => array(
        'name' => __( 'Teams' ),
        'singular_name' => __( 'Team' ),
        'add_new' => __( 'Add Team' ),
'add_new_item' => __( 'Add New Team' ),
'edit' => __( 'Edit' ),
'edit_item' => __( 'Edit Team' ),
'new_item' => __( 'New Team' ),
'view' => __( 'View Team' ),
'view_item' => __( 'View Team' ),
'search_items' => __( 'Search Team' ),
'not_found' => __( 'No Team found' ),
'not_found_in_trash' => __( 'No Team found in Trash' ),
'parent' => __( 'Parent Team' )
      ),
      'public' => true,
      'has_archive' => true,
      'supports' => array('title', 'editor', 'thumbnail','custom-fields'),
      'taxonomies' => array('category', 'post_tag'),
      'rewrite' => array('slug' => 'Teams'),
     
    )
  );
}

function my_rewrite_flushh() {
    flush_rewrite_rules();
}
add_action( 'after_switch_theme', 'my_rewrite_flushh' );





?>



No comments:

Post a Comment