Tagged: x
-
AuthorPosts
-
April 24, 2016 at 4:46 am #897291
AlexParticipantHello,
who can I hide the author and category in posts and modify the size and color of the publish date.
Also I need to add a custom Field.Thank you very much!
Regards,
AlexApril 24, 2016 at 11:59 pm #898055
LelyModeratorHi Alex,
Thanks for posting in. Please add the following CSS in Customizer’s > Custom CSS:
p.p-meta span:first-of-type { display: none; } p.p-meta span + span { color: red; /*Change to your preferred color*/ font-size: 20px; /* Change to your preferred font size*/ }Please do share us your site URL if this doesn’t work.
To add custom field, please click Screen Option from the upper right part of the page. Check custom field. Then on the lower part the option for this will open. See attached screenshots.
Always,
XApril 25, 2016 at 5:21 am #898380
AlexParticipantOkay,
how can I hide the Category
and how can I make a custom field visible at the postlist?Thank you very much!
Regards
AlexApril 25, 2016 at 12:19 pm #898939
RupokMemberHi Alex,
Kindly share your URL so that we could check and give you some tailored code.
Cheers!
April 25, 2016 at 3:20 pm #899251
AlexParticipantThis reply has been marked as private.April 26, 2016 at 7:18 am #900182
Paul RModeratorHi,
Thank you for providing your login credentials.
I went ahead and added this code in your child theme’s functions.php file to remove author and category.
function x_integrity_entry_meta() { // // Author. // $author = sprintf( '<span><i class="x-icon-pencil" data-x-icon=""></i> %s</span>', get_the_author() ); // // Date. // $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %2$s</time></span>', esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); // // Categories. // if ( get_post_type() == 'x-portfolio' ) { if ( has_term( '', 'portfolio-category', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'portfolio-category' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'portfolio-category' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } else { $categories_list = ''; } } else { $categories = get_the_category(); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } // // Comments link. // if ( comments_open() ) { $title = apply_filters( 'x_entry_meta_comments_title', get_the_title() ); $link = apply_filters( 'x_entry_meta_comments_link', get_comments_link() ); $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() ); if ( $number == 0 ) { $text = __( 'Leave a Comment' , '__x__' ); } else if ( $number == 1 ) { $text = $number . ' ' . __( 'Comment' , '__x__' ); } else { $text = $number . ' ' . __( 'Comments' , '__x__' ); } $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon=""></i> %3$s</a></span>', esc_url( $link ), esc_attr( sprintf( __( 'Leave a comment on: “%s”', '__x__' ), $title ) ), $text ); } else { $comments = ''; } // // Output. // if ( x_does_not_need_entry_meta() ) { return; } else { printf( '<p class="p-meta">%1$s%2$s</p>', $date, $comments ); } }With regards to custom field, can you specify what kind of data you want to add.
Thanks
April 26, 2016 at 7:20 am #900184
AlexParticipantHello,
thank you very much!
I want to add a custom field (created with Advanced Custom Fields) called “eintritt”.Cheers,
AlexApril 27, 2016 at 1:37 am #901524
Paul RModeratorHi Alex,
To display it, you can use this code to display custom field.
<?php echo get_post_meta($post->ID, 'eintritt', true); ?>eg.
function x_integrity_entry_meta() { Global $post; // // Author. // $author = sprintf( '<span><i class="x-icon-pencil" data-x-icon=""></i> %s</span>', get_the_author() ); // // Date. // $date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %2$s</time></span>', esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); // // Categories. // if ( get_post_type() == 'x-portfolio' ) { if ( has_term( '', 'portfolio-category', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'portfolio-category' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'portfolio-category' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } else { $categories_list = ''; } } else { $categories = get_the_category(); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } // // Comments link. // if ( comments_open() ) { $title = apply_filters( 'x_entry_meta_comments_title', get_the_title() ); $link = apply_filters( 'x_entry_meta_comments_link', get_comments_link() ); $number = apply_filters( 'x_entry_meta_comments_number', get_comments_number() ); if ( $number == 0 ) { $text = __( 'Leave a Comment' , '__x__' ); } else if ( $number == 1 ) { $text = $number . ' ' . __( 'Comment' , '__x__' ); } else { $text = $number . ' ' . __( 'Comments' , '__x__' ); } $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-comments" data-x-icon=""></i> %3$s</a></span>', esc_url( $link ), esc_attr( sprintf( __( 'Leave a comment on: “%s”', '__x__' ), $title ) ), $text ); } else { $comments = ''; } // // Output. // if ( x_does_not_need_entry_meta() ) { return; } else { printf( '<p class="p-meta">%1$s%2$s %3$s</p>', $date, $comments, get_post_meta($post->ID, 'eintritt', true) ); } }Hope that helps.
April 27, 2016 at 2:30 am #901579
AlexParticipantCan I add this code to the function.php of the Child Theme?
April 27, 2016 at 11:24 am #902515
JadeModeratorHi there,
Yes, you can simply modify the code we have added on our previous response which is in the functions.php file. 🙂
April 28, 2016 at 8:27 am #904079
AlexParticipantokay.
and where have I to enter this code?
<?php echo get_post_meta($post->ID, 'eintritt', true); ?>Sorry for all that silly questions 🙂
Thank you very much!
Regards,
AlexApril 28, 2016 at 9:09 pm #905052
Rue NelModeratorHey Alex,
The complete code is already given here:
https://community.theme.co/forums/topic/posts-hide-author-scale-date-add-custom-field/#post-901524Please let us know how it goes.
May 12, 2016 at 3:11 am #987352
AlexParticipantYes.
You gave me 2 code parts.I have to put the second part into the functions.php
But where do I have to put the first part?May 12, 2016 at 3:45 am #987405
LelyModeratorHello There,
The first part was already added on the second part of the code at the bottom. Please check attached screenshot.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-897291 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
