', ']]>', $raw_content ); return $content; } // the_content format text function niyo_holiday_the_content_format( $str ){ echo niyo_holiday_get_the_content_format( $str ); } // remove excerpt more function niyo_holiday_new_excerpt_more( $more ) { return '... '; } add_filter('excerpt_more', 'niyo_holiday_new_excerpt_more'); function niyo_holiday_string_limit_words($string, $word_limit){ $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); return implode(' ', $words); } // get post categories function function niyo_holiday_getPostCategories(){ $categories = get_the_category(); $catOut = ''; $separator = ', '; $catOutput = ''; if($categories){ foreach($categories as $category) { $catOutput .= 'name ) ) . '">'.$category->cat_name.''.$separator; } $catOut = 'Categories: '.trim($catOutput, $separator); } return $catOut; } // replace last occurance of a string. function niyo_holiday_str_lreplace($search, $replace, $subject){ $pos = strrpos($subject, $search); if($pos !== false){ $subject = substr_replace($subject, $replace, $pos, strlen($search)); } return $subject; } // create custom widget for social media class Footer_Social_Widget extends WP_Widget { // Register widget with WordPress. public function __construct() { parent::__construct( 'footer_social_widget', // Base ID 'Social Media', // Name array( 'description' => __( 'Social media widget for footer', 'niyo-holiday' ), ) // Args ); } // Front-end display of widget. public function widget( $args, $instance ) { extract( $args ); $title = apply_filters( 'widget_title', $instance['title'] ); $facebook = ( $instance['facebook'] != '' ) ? $instance['facebook'] : ''; $twitter = ( $instance['twitter'] != '' ) ? $instance['twitter'] : ''; $googleplus = ( $instance['googleplus'] != '' ) ? $instance['googleplus'] : ''; $linkedin = ( $instance['linkedin'] != '' ) ? $instance['linkedin'] : ''; $youtube = ( $instance['youtube'] != '' ) ? $instance['youtube'] : ''; echo $before_widget; if ( ! empty( $title ) ) echo $before_title . $title . $after_title; echo ( ($facebook!='') ? 'Facebook' : ''). ( ($twitter!='') ? 'Twitter' : ''). ( ($googleplus!='') ? 'Google+' : ''). ( ($linkedin!='') ? 'LinkedIn' : ''). ( ($youtube!='') ? 'Youtube' : ''); echo $after_widget; } // Back-end widget form. public function form( $instance ) { if ( isset( $instance[ 'title' ] ) ) { $title = $instance[ 'title' ]; }else { $title = __( 'Follow Us', 'niyo-holiday' ); } $facebook = ( isset( $instance[ 'facebook' ] ) ) ? $instance[ 'facebook' ] : ''; $twitter = ( isset( $instance[ 'twitter' ] ) ) ? $instance[ 'twitter' ] : ''; $googleplus = ( isset( $instance[ 'googleplus' ] ) ) ? $instance[ 'googleplus' ] : ''; $linkedin = ( isset( $instance[ 'linkedin' ] ) ) ? $instance[ 'linkedin' ] : ''; $youtube = ( isset( $instance[ 'youtube' ] ) ) ? $instance[ 'youtube' ] : ''; ?>