Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134630

zagore on "Fix this code if (in_category..."

$
0
0

I want that the date and author appear just in several categories. I have this code, but it do an error.

Do you know how fix this code?
Thank you.

function admired_posted_on() { if ( in_category( '18' ) )
printf( __( '<span class="sep"></span><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></span>', 'admired' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
sprintf( esc_attr__( 'View all posts by %s', 'admired' ), get_the_author() ),
esc_html( get_the_author() )
);
}

elseif ( in_category ('15', '20') ) {
printf( __( '<span class="by-author"> <span class="sep"> by </span> <span class="author vcard"></span></span>', 'admired' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
sprintf( esc_attr__( 'View all posts by %s', 'admired' ), get_the_author() ),
esc_html( get_the_author() )
);
}

endif;


Viewing all articles
Browse latest Browse all 134630


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>