funcions_ionic.docx

download funcions_ionic.docx

of 14

Transcript of funcions_ionic.docx

  • 7/30/2019 funcions_ionic.docx

    1/14

  • 7/30/2019 funcions_ionic.docx

    2/14

    * Translations can be added to the /languages/ directory.

    */

    load_theme_textdomain( 'themonic', get_template_directory() . '/languages' );

    // Adds RSS feed links to for posts and comments.

    add_theme_support( 'automatic-feed-links' );

    // Adds support for Navigation menu, Iconic One uses wp_nav_menu() in one location.

    register_nav_menu( 'primary', __( 'Primary Menu', 'themonic' ) );

    // Iconic One supports custom background color and image using default wordpress

    funtions.

    add_theme_support( 'custom-background', array(

    'default-color' => 'e8e8e8',

    ) );

    // Uncomment the following two lines to add support for post thumbnails - for classic blog

    layout

    add_theme_support( 'post-thumbnails' );

    set_post_thumbnail_size( 660, 9999 ); // Unlimited height, soft crop

    }

    add_action( 'after_setup_theme', 'themonic_setup' );

    add_image_size('excerpt-thumbnail', 200, 140, true);

  • 7/30/2019 funcions_ionic.docx

    3/14

    /*

    * Loads the Themonic Customizer for live customization, to learn more visit Themonic.com

    */

    require_once( get_template_directory() . '/inc/themonic-customizer.php' );

    /*

    * Enqueueing scripts and styles for front-end of the Themonic Framework.

    * @since Iconic One 1.0

    */

    function themonic_scripts_styles() {

    global $wp_styles;

    /*

    * Adds JavaScript to pages with the comment form to support

    * sites with threaded comments (when in use).

    */

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )

    wp_enqueue_script( 'comment-reply' );

    /*

    * Adds Selectnav.js JavaScript for handling the navigation menu and creating a select

    based navigation for reposive layout.

    */

    wp_enqueue_script('themonic-mobile-navigation', get_template_directory_uri() .

    '/js/selectnav.js', array(), '1.0', true );

    /*

  • 7/30/2019 funcions_ionic.docx

    4/14

    * Loads the awesome readable ubuntu font CSS file for Iconic One.

    */

    if ( 'off' !== _x( 'on', 'Ubuntu font: on or off', 'themonic' ) ) {

    $subsets = 'latin,latin-ext';

    $protocol = is_ssl() ? 'https' : 'http';

    $query_args = array(

    'family' => 'Ubuntu:400,700',

    'subset' => $subsets,

    );

    wp_enqueue_style( 'themonic-fonts', add_query_arg( $query_args,"$protocol://fonts.googleapis.com/css" ), array(), null );

    }

    /*

    * Loads Themonic's main stylesheet and the custom stylesheet.

    */

    wp_enqueue_style( 'themonic-style', get_stylesheet_uri() );

    wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/custom.css' );

    /*

    * Loads the Internet Explorer specific stylesheet.

    */

    wp_enqueue_style( 'themonic-ie', get_template_directory_uri() . '/css/ie.css', array(

    'themonic-style' ), '20130305' );

    $wp_styles->add_data( 'themonic-ie', 'conditional', 'lt IE 9' );

    }

    add_action( 'wp_enqueue_scripts', 'themonic_scripts_styles' );

  • 7/30/2019 funcions_ionic.docx

    5/14

    /*

    * WP Title Filter, refer http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_title

    * @since Iconic One 1.0

    */

    function themonic_wp_title( $title, $sep ) {

    global $paged, $page;

    if ( is_feed() )

    return $title;

    // Add the site name.

    $title .= get_bloginfo( 'name' );

    // Add the site description for the home/front page.

    $site_description = get_bloginfo( 'description', 'display' );

    if ( $site_description && ( is_home() || is_front_page() ) )

    $title = "$title $sep $site_description";

    // Add a page number if necessary.

    if ( $paged >= 2 || $page >= 2 )

    $title = "$title $sep " . sprintf( __( 'Page %s', 'themonic' ), max( $paged, $page ) );

    return $title;

    }

    add_filter( 'wp_title', 'themonic_wp_title', 10, 2 );

  • 7/30/2019 funcions_ionic.docx

    6/14

    /*

    * Default Nav Menu fallback to Pages menu,

    * Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link.

    * @since Iconic One 1.0

    */

    function themonic_page_menu_args( $args ) {

    if ( ! isset( $args['show_home'] ) )

    $args['show_home'] = true;

    return $args;

    }

    add_filter( 'wp_page_menu_args', 'themonic_page_menu_args' );

    /**

    * Registers the main widgetized sidebar area.

    *

    * @since Iconic O-n-e 1.0

    */

    function themonic_widgets_init() {

    register_sidebar( array(

    'name' => __( 'Main Sidebar', 'themonic' ),

    'id' => 'themonic-sidebar',

    'description' => __( 'Appears on posts and pages except the optional Front Page

    template, which has its own widgets', 'themonic' ),

    'before_widget' => '',

    'after_widget' => '',

  • 7/30/2019 funcions_ionic.docx

    7/14

    'before_title' => '

    ',

    'after_title' => '

    ',

    ) );

    }

    add_action( 'widgets_init', 'themonic_widgets_init' );

    if ( ! function_exists( 'themonic_content_nav' ) ) :

    /**

    * Displays navigation to next/previous pages when applicable.

    *

    * @since Iconic One 1.0

    */

    function themonic_content_nav( $html_id ) {

    global $wp_query;

    $html_id = esc_attr( $html_id );

    if ( $wp_query->max_num_pages > 1 ) : ?>

  • 7/30/2019 funcions_ionic.docx

    8/14

    }

    endif;

    if ( ! function_exists( 'themonic_comment' ) ) :

    /**

    * Template for comments and pingbacks.

    *

    * To override this walker in a child theme without modifying the comments template

    * simply create your own themonic_comment(), and that function will be used instead.

    *

    * Used as a callback by wp_list_comments() for displaying the comments.

    *

    * @since Iconic One 1.0

    */

    function themonic_comment( $comment, $args, $depth ) {

    $GLOBALS['comment'] = $comment;

    switch ( $comment->comment_type ) :

    case 'pingback' :

    case 'trackback' :

    // Display trackbacks differently than normal comments.

    ?>

  • 7/30/2019 funcions_ionic.docx

    9/14

    default :

    // Proceed with normal comments.

    global $post;

    ?>

  • 7/30/2019 funcions_ionic.docx

    10/14

  • 7/30/2019 funcions_ionic.docx

    11/14

    *

    * Create your own themonic_entry_meta() to override in a child theme.

    *

    * @since Iconic One 1.0

    */

    function themonic_entry_meta() {

    // Translators: used between list items, there is a space after the comma.

    $categories_list = get_the_category_list( __( ', ', 'themonic' ) );

    // Translators: used between list items, there is a space after the comma.

    $tag_list = get_the_tag_list( '', __( ', ', 'themonic' ) );

    $date = sprintf( '%4$s',

    esc_url( get_permalink() ),

    esc_attr( get_the_time() ),

    esc_attr( get_the_date( 'c' ) ),

    esc_html( get_the_date() )

    );

    $author = sprintf( '%3$s',

    esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),

    esc_attr( sprintf( __( 'View all posts by %s', 'themonic' ), get_the_author() ) ),

    get_the_author()

    );

  • 7/30/2019 funcions_ionic.docx

    12/14

    // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.

    if ( $tag_list ) {

    $utility_text = __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'themonic' );

    } elseif ( $categories_list ) {

    $utility_text = __( 'This entry was posted in %1$s on %3$s by %4$s.', 'themonic' );

    } else {

    $utility_text = __( 'This entry was posted on %3$s by

    %4$s.', 'themonic' );

    }

    printf(

    $utility_text,

    $categories_list,

    $tag_list,

    $date,

    $author

    );

    }

    endif;

    /*

    * WordPress body class Extender :

    * 1. Using a full-width layout without widgets.

    * 2. White or empty background color.

  • 7/30/2019 funcions_ionic.docx

    13/14

    * 3. Custom fonts enabled.

    * 4. Single or multiple authors.

    *

    * @since Iconic One 1.0

    */

    function themonic_body_class( $classes ) {

    $background_color = get_background_color();

    if ( ! is_active_sidebar( 'themonic-sidebar' ) || is_page_template( 'page-templates/full-

    width.php' ) )

    $classes[] = 'full-width';

    if ( empty( $background_color ) )

    $classes[] = 'custom-background-empty';

    elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )

    $classes[] = 'custom-background-white';

    // Enable custom font class only if the font CSS is queued to load.

    if ( wp_style_is( 'themonic-fonts', 'queue' ) )

    $classes[] = 'custom-font-enabled';

    if ( ! is_multi_author() )

    $classes[] = 'single-author';

    return $classes;

    }

  • 7/30/2019 funcions_ionic.docx

    14/14

    add_filter( 'body_class', 'themonic_body_class' );

    /*

    * Adjusts content_width value for full-width and single image attachment

    * templates, and when there are no active widgets in the sidebar.

    *

    * @since Iconic One 1.0

    */

    function themonic_content_width() {

    if ( is_page_template( 'page-templates/full-width.php' ) || is_attachment() || !is_active_sidebar( 'themonic-sidebar' ) ) {

    global $content_width;

    $content_width = 1040;

    }

    }

    add_action( 'template_redirect', 'themonic_content_width' );

    /* I-c-o-n-i-c O-n-e welcome text */

    if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )

    wp_redirect( 'themes.php?page=iconic_one_theme_options');

    require_once( get_template_directory() . '/inc/iconic-one-options.php' );