Snippets

Crumina Team [Polo] Custom social share

Created by Alexandr Kostyrka


function polo_post_meta( $args = array() ) {

		$output = '';

		$defaults = array(
			'show_date'     => true,
			'show_comments' => true,
			'show_share'    => true
		);
		$args     = wp_parse_args( $args, $defaults );

		$output .= '<div class="post-meta">';

		if ( true === $args['show_date'] ) {

			$output .= '<div class="post-date">';
			$output .= '<span class="post-date-day">' . get_the_date( 'd', get_the_ID() ) . '</span>' . ' ';
			$output .= '<span class="post-date-month">' . get_the_date( 'M', get_the_ID() ) . '</span>' . ' ';
			$output .= '<span class="post-date-year">' . get_the_date( 'Y', get_the_ID() ) . '</span>';
			$output .= '</div>';

		}

		if ( true === $args['show_comments'] ) {

			$output .= '<div class="post-comments">';
			$output .= '<a href="' . esc_url(get_comments_link( get_the_ID() )) . '">';
			$output .= '<i class="fa fa-comments-o"></i>';
			$output .= '<span class="post-comments-number"> ' . get_comments_number( get_the_ID() ) . '</span>';
			$output .= '</a>';
			$output .= '</div>';

		}

		if ( true === $args['show_share'] ) {

			wp_enqueue_script( 'crum-likely' );

			$output .= '<div class="post-comments"><div class="likely" data-url="' . get_the_permalink( get_the_ID() ) . '" data-title="' . get_the_title( get_the_ID() ) . '"  >
			<div class="facebook"></div> ';
			$output .= '</div></div>';

		}

		$output .= '</div>';

		return $output;

	}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.