-
AuthorPosts
-
December 4, 2014 at 7:43 am #158211
Hi there,
Hope you can help us. We set up a Renew-Child-Theme for our site (http://www.ahja.ch/div/mueller/) and were trying to change a few things with the help in this forum but it didn’t work so far.
1. The meta post line should be in German, like this:
17. September 2014 von Philippe Müller
instead of
Philippe Müller / 09.2014 / Allgemein / 1 Comment
2. In the comment (http://www.ahja.ch/div/mueller/?p=1841) we would like to change the date too.
02.12.2014 um 14:18 (= Day.Month.Year)
instead of
12.02.2014 at 14:18
3. Where can we translate “One Comment on”? which appears when someone writes a comment.
4. How can we add Facebook and Twitter share buttons at the end of each post?
Thank you in advance for your help.
December 4, 2014 at 11:55 am #158380Hi there,
Thanks for writing in!
#1: Add following code in your child theme’s functions.php file:
if ( ! function_exists( 'x_renew_entry_meta' ) ) : function x_renew_entry_meta() { // // Author. // $author = sprintf( '<span>%s</span>', get_the_author() ); // // Date. // $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( 'm.Y' ) ) ); // // 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 ) ) . '"> ' . $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 ) ) . '">' . $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">%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 { $date = sprintf( '<time class="entry-date" datetime="%1$s">%2$s</time>', esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date( 'd.F Y' ) ) ); printf( '<p class="p-meta">%1$s von %2$s</p>', $date, $author ); } } endif;
#2: Add following in your child theme’s functions.php file:
if ( ! function_exists( 'x_renew_comment' ) ) : function x_renew_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : // 1 case 'trackback' : // 1 ?> <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>"> <p><?php _e( 'Pingback:', '__x__' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', '__x__' ), '<span class="edit-link">', '</span>' ); ?></p> <?php break; default : // 2 GLOBAL $post; if ( X_WOOCOMMERCE_IS_ACTIVE ) : $rating = esc_attr( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ); endif; if ( x_is_product() ) { $comment_avatar = get_avatar( $comment, 240 ); } else { $comment_avatar = get_avatar( $comment, 120 ); } ?> <li id="li-comment-<?php comment_ID(); ?>" <?php comment_class(); ?>> <article id="comment-<?php comment_ID(); ?>" class="comment"> <?php printf( '<div class="x-comment-img">%s</div>', '<span class="avatar-wrap cf">' . $comment_avatar . '</span>' ); ?> <?php if ( ! x_is_product() ) : ?> <div class="x-reply"> <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span class="comment-reply-link-after"><i class="x-icon-reply"></i></span>', '__x__' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> </div> <?php endif; ?> <div class="x-comment-wrap"> <header class="x-comment-header"> <?php printf( '<cite class="x-comment-author">%1$s</cite>', get_comment_author_link() ); if ( x_is_product() && get_option('woocommerce_enable_review_rating') == 'yes' ) : ?> <div class="star-rating-container"> <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf(__( 'Rated %d out of 5', 'woocommerce' ), $rating) ?>"> <span style="width:<?php echo ( intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ); ?></strong> <?php _e( 'out of 5', 'woocommerce' ); ?></span> </div> </div> <?php endif; printf( '<div><a href="%1$s" class="x-comment-time"><time datetime="%2$s">%3$s</time></a></div>', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), sprintf( __( '%1$s um %2$s', '__x__' ), get_comment_date( 'd.m.Y' ), get_comment_time() ) ); edit_comment_link( __( '<i class="x-icon-edit"></i> Edit', '__x__' ) ); ?> </header> <?php if ( '0' == $comment->comment_approved ) : ?> <p class="x-comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', '__x__' ); ?></p> <?php endif; ?> <section class="x-comment-content"> <?php comment_text(); ?> </section> </div> </article> <?php break; endswitch; } endif;
#3: If you’re using WPML, you can use WPML string translation to translate the strings. You can review this article for more information: http://wpml.org/documentation/getting-started-guide/string-translation/
#4: Add following in your child theme’s functions.php file:
add_filter( 'the_content', 'custom_author_code'); function custom_author_code($content) { if ( is_singular('post') ) { return $content . do_shortcode('[share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]'); } else { return $content; } }
Hope this helps. 🙂
Thank you.
January 13, 2015 at 9:15 am #182032Hi there,
Thank you for your help. I copied the code you provided in the child theme’s functions.php file. The meta post line looks fine (see https://www.ahja.ch/div/mueller/), but the posts can’t be found anymore (404 error), see https://www.ahja.ch/div/mueller/?p=1841
Something with the #4 social media share buttons code has to be wrong. Without this code it’s working properly.
Thank you.
January 13, 2015 at 9:43 pm #182446Hi,
For #4
You can create _content-the-content.php file in wp-content/themes/x-child-renew/framework/views/global
and copy the code below into that file.<?php // ============================================================================= // VIEWS/GLOBAL/_CONTENT-THE-CONTENT.PHP // ----------------------------------------------------------------------------- // Display of the_content() for various entries. // ============================================================================= ?> <?php do_action( 'x_before_the_content_begin' ); ?> <div class="entry-content content"> <?php do_action( 'x_after_the_content_begin' ); ?> <?php the_content(); if(is_single()): echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]'); endif; ?> <?php x_link_pages(); ?> <?php do_action( 'x_before_the_content_end' ); ?> </div> <?php do_action( 'x_after_the_content_end' ); ?>
Hope that helps.
January 16, 2015 at 8:48 am #184442Hi,
Thank you. I created _content-the-content.php file in wp-content/themes/x-child-renew/framework/views/global But there is still a 404 error showing up when trying to open a post: https://www.ahja.ch/div/mueller/?p=1841 (or try here: https://www.ahja.ch/div/mueller/
Hope you can help.
January 17, 2015 at 4:54 am #184971Hi there,
Please update your theme and X shortocde referring to theme.co/x/member/kb/updating-your-theme-and-plugins/.
If the issue persist after updating let us know about it.
Thank you.
January 19, 2015 at 8:29 am #186160Hi there,
Thank you. I updated the theme as well as X shortcode, but the issue persists.
January 19, 2015 at 11:50 pm #186575January 22, 2015 at 8:42 am #189072Hi,
That helped. Thank you for the support.
January 22, 2015 at 9:17 pm #189633Glad we were able to help 🙂
-
AuthorPosts