????
Current Path : /home2/sarkar82/www/wp-content/themes/iconic-one-pro/inc/ |
Current File : //home2/sarkar82/www/wp-content/themes/iconic-one-pro/inc/io-pro-functions.php |
<?php /*-----------------------------------------------------------------------------------*/ /* Breadcrumb function| Updated on January 8, 2015 /*-----------------------------------------------------------------------------------*/ function iop_breadcrumb() { global $post; $parent_title = get_the_title( $post->post_parent ); echo '<a href="'; echo home_url(); echo '">'; echo __( 'Home','themonic'); echo "</a>"; if (is_category() || is_single()) { echo " » "; the_category(' • '); if (is_single()) { echo " » "; the_title(); } } elseif ( is_page() && $post->post_parent > 0 ) { echo " » "; if ( $parent_title != the_title( ' ', ' ', false ) ) { echo '<a href="' . get_permalink( $post->post_parent ) . '" title="' . $parent_title . '">' . $parent_title . '</a>'; } echo " » "; echo the_title(); } elseif (is_page()) { echo " » "; echo the_title(); } elseif (is_search()) { echo " » Search Results for... "; echo '"<em>'; echo the_search_query(); echo '</em>"'; } } /*-----------------------------------------------------------------------------------*/ /* Pagination /*-----------------------------------------------------------------------------------*/ function themonic_pagination($pages = '', $range = 3) { $showitems = ($range * 3)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "<div class='pagination'><ul>"; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<li><a href='".get_pagenum_link(1)."'>« First</a></li>"; if($paged > 1 && $showitems < $pages) echo "<li><a href='".get_pagenum_link($paged - 1)."' class='inactive'>‹ Previous</a></li>"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "<li class='current'><span class='currenttext'>".$i."</span></li>":"<li><a href='".get_pagenum_link($i)."' class='inactive'>".$i."</a></li>"; } } if ($paged < $pages && $showitems < $pages) echo "<li><a href='".get_pagenum_link($paged + 1)."' class='inactive'>Next ›</a></li>"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a class='inactive' href='".get_pagenum_link($pages)."'>Last »</a>"; echo "</ul></div>"; }} //G+ Author integration add_action( 'show_user_profile', 'iop_user_profile_fields' ); add_action( 'edit_user_profile', 'iop_user_profile_fields' ); function iop_user_profile_fields( $user ) { ?> <h3><?php _e('Iconic One Pro User Profile Fields', 'themonic'); ?></h3> <table class="form-table"> <tr> <th><label for="linkedin"><?php _e('LinkedIn', 'themonic'); ?></label></th> <td> <input type="text" name="linkedin" id="linkedin" value="<?php echo esc_attr( get_the_author_meta( 'linkedin', $user->ID ) ); ?>" class="regular-text" /><br /> <span class="description"><?php _e('Please enter your LinkedIn ID.', 'themonic'); ?></span> </td> </tr> <tr> <th><label for="twitter"><?php _e('Twitter', 'themonic'); ?></label></th> <td> <input type="text" name="twitter" id="twitter" value="<?php echo esc_attr( get_the_author_meta( 'twitter', $user->ID ) ); ?>" class="regular-text" /><br /> <span class="description"><?php _e('Please enter your Twitter ID.', 'themonic'); ?></span> </td> </tr> <tr> <th><label for="facebook"><?php _e('Facebook', 'themonic'); ?></label></th> <td> <input type="text" name="facebook" id="facebook" value="<?php echo esc_attr( get_the_author_meta( 'facebook', $user->ID ) ); ?>" class="regular-text" /><br /> <span class="description"><?php _e('Please enter your Facebook ID.', 'themonic'); ?></span> </td> </tr> <tr> <th><label for="instagram"><?php _e('Instagram', 'themonic'); ?></label></th> <td> <input type="text" name="instagram" id="instagram" value="<?php echo esc_attr( get_the_author_meta( 'instagram', $user->ID ) ); ?>" class="regular-text" /><br /> <span class="description"><?php _e('Please enter your Instagram ID.', 'themonic'); ?></span> </td> </tr> </table> <?php } add_action( 'personal_options_update', 'iop_save_profile_fields' ); add_action( 'edit_user_profile_update', 'iop_save_profile_fields' ); function iop_save_profile_fields( $user_id ) { if ( !current_user_can( 'edit_user', $user_id ) ) { return false; } update_user_meta( $user_id, 'linkedin', $_POST['linkedin'] ); update_user_meta( $user_id, 'twitter', $_POST['twitter'] ); update_user_meta( $user_id, 'facebook', $_POST['facebook'] ); update_user_meta( $user_id, 'instagram', $_POST['instagram'] ); } //G+ Author integration //Font Awesome integration function ioproawesome_css() { wp_enqueue_style('fontawesome-css', get_stylesheet_directory_uri().'/fonts/font-awesome.min.css' ); } add_action('wp_enqueue_scripts', 'ioproawesome_css'); /** Branding //*<?php $options = get_option('iconiconepro'); ?> //*Custom admin login header logo .get_bloginfo('template_directory').'/img/admin-logo.png <?php echo $options['wp_login_logo'];?>$io_adminlogo = $options['wp_login_logo'];*/ function iconic_one_login_logo() { $options = get_option('iconiconepro'); if (isset ($options['wp_login_logo']) ){ echo '<style type="text/css"> h1 a {background-image: url(' . $options['wp_login_logo'] . ') !important; } .login h1 a {background-size: auto; height: auto; width:320px; min-height: 75px;} </style>'; } } add_action( 'login_head', 'iconic_one_login_logo' ); add_filter( 'login_headerurl', 'iop_loginlogo_url' ); function iop_loginlogo_url($url) { return get_home_url(); } /** * Custom admin login header logo */ $options = get_option('iconiconepro'); if( isset ($options['themonic_slider'])&& $options['themonic_slider'] == '1' || $options['themonic_category_slider'] == '1' ) { /**flexslider and its css **/ function themonic_slider_scripts() { wp_enqueue_script('flexslider', get_stylesheet_directory_uri().'/js/jquery.flexslider-min.js', array('jquery')); wp_enqueue_script('flexslider-init', get_stylesheet_directory_uri().'/js/flexslider-init.js', array('jquery', 'flexslider')); } add_action('wp_enqueue_scripts', 'themonic_slider_scripts'); function themonic_slider_css() { wp_enqueue_style('flexslider', get_stylesheet_directory_uri().'/js/flexslider.css'); } add_action('wp_enqueue_scripts', 'themonic_slider_css'); /**flexslider and its css **/ } /**Iconic One Pro custom function to Limit tags**/ add_filter('term_links-post_tag','ioptags'); function ioptags($terms) { if (is_home() ) {return array_slice($terms,0,3,true);} else {return array_slice($terms,false);} } /**Limit tags**/