Tagged: x
-
AuthorPosts
-
January 12, 2017 at 7:18 pm #1328055
Hi!
I am using v. 4.6.4 X Theme with activated child theme and Icon Stack.
URL: http://happypeople.blogI have upgraded my old premium theme “Simple & Elegant” to Theme X and I am happy I did. Now I am trying to give my site the same look as it was with my Simple & Elegant theme.
Old site URL: http://makoeva.net/I want post meta to show Date, Categories, Leave a comment, just like on http://makoeva.net/
Font PT Sans, Font site: 12, color black.
I also want to add a separator between post header and post meta, just like or similar to http://makoeva.net/I have tried following instructions on link below, buy with no success: https://community.theme.co/forums/topic/icon-stack-post-meta-author-tags-categories-not-showing-in-posts/
Your help will be greatly appreciated.
January 12, 2017 at 11:24 pm #1328314Hi there,
Thanks for writing in! You can add the below code within your Child Theme’s functions.php
// Entry Meta // ============================================================================= if ( ! function_exists( 'x_icon_entry_meta' ) ) : function x_icon_entry_meta() { $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>', esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); if ( x_does_not_need_entry_meta() ) { return; } else { printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>', $date, $author, $categories_list ); } } endif;
Then you can add this under Custom > CSS in the Customizer.
.entry-header .p-meta { color: #000; font-family: "PT Sans",sans-serif; font-size: 12px; opacity: 1; }
Make sure to set PT Sans font from Customize > Typography.
Cheers!
January 13, 2017 at 3:23 pm #1329204This reply has been marked as private.January 13, 2017 at 11:28 pm #1329571Hi there,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
Thanks.
January 17, 2017 at 6:26 pm #1334263This reply has been marked as private.January 18, 2017 at 12:42 am #1334613Hi there,
Please update your code in functions.php file to :
// Entry Meta // ============================================================================= if ( ! function_exists( 'x_icon_entry_meta' ) ) : function x_icon_entry_meta() { $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-clock" 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-folder" 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-folder" 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() ); $text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number ); $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments"><i class="x-icon-sticky-note" 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">%2$s%3$s%4$s</p>', $author, $date, $categories_list, $comments ); } } endif;
Please add following code in Customize -> Custom -> Global CSS :
p.p-meta span, p.p-meta a { color: #000; font-size: 12px; font-family: PT Sans-serif; }
Hope it helps.
January 18, 2017 at 2:50 pm #1335614Thank you for your code! It worked for the most part.
The comments are not inline with date and category meta, instead, they have floated to the right side of the page in a little round bubble.
How do I have a leave a comment link inline with date and category meta?
I do not need this meta tag to count the amount of comments there are.
Just a link to a comment section is best.Thank you again for you support!
January 18, 2017 at 3:00 pm #1335630Another problem I noticed is font size of date and category meta tags are different.
It stays different even if I remove custom CSS styling.
January 18, 2017 at 9:28 pm #1336133Hello There,
Please add this custom CSS too:
a.meta-comments { position: relative; width: initial; height: initial; border: transparent; background: transparent; top: initial; right: initial; }
Then look for this line from above code:
$text = ( 0 === $number ) ? 'Leave a Comment' : sprintf( _n( '%s Comment', '%s Comments', $number, '__x__' ), $number );
Update to this:
$text = ( 0 === $number ) ? 'Leave a Comment' : _n( ' Comment', ' Comments', $number, '__x__' );
Look for this custom CSS:
/* date color*/ .entry-date { color:#00000; font-size: 80%; }
This line
font-size: 80%;
makes the date font smaller. Please remove it.Hope this helps.
January 19, 2017 at 9:05 pm #1337736This is great.
Now everything is working the way we want it to.Thank you all for your patient, detailed and tailored support!
January 19, 2017 at 10:29 pm #1337804You are most welcome. π
January 23, 2017 at 9:00 pm #1342536Hello again!
With further testing I found out that the comment meta tag displays differently in some browsers.
To achieve desired look of the comment meta tag I translated tags to Russian by editing functions.php like this:
Original code: $text = ( 0 === $number ) ? 'Leave a Comment' : _n( ' Comment', ' Comments', $number, '__x__' ); Edited as: $text = ( 0 === $number ) ? 'ΠΡΡΠ°Π²ΠΈΡΡ ΠΊΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ' : _n( ' ΠΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΉ', ' ΠΠΎΠΌΠΌΠ΅Π½ΡΠ°ΡΠΈΠΈ', $number, '__x__' );
In some browsers life Firefox comments meta tag displays correctly in Russian, while in other browsers like Edge or iOS browser it still displays as “0 Comments” in English.
Hope you can help.
January 24, 2017 at 2:17 am #1342745Hello There,
I did check on IE, CHROME and FIREFOX and everything says COMMENTS and not the russian translation. Please do give us admin credentials again so we can check your settings.
January 24, 2017 at 10:35 am #1343337This reply has been marked as private.January 24, 2017 at 11:31 pm #1344254Hi,
I tried your code in my test site and it seems to work.
It seems that something is overriding the code in your site.
Can you try testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
Thanks
-
AuthorPosts