2016-07-09 3 views
0
<?php 
if ('on' === $show_author || 'on' === $show_date || 'on' === $show_categories || 'on' === $show_comments) { 
    printf('<p class="post-meta">%1$s %2$s %3$s %4$s %5$s %6$s %7$s</p>', 
     (
      'on' === $show_author 
       ? et_get_safe_localization(sprintf(__('by %s', 'et_builder'), '<span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>')) 
       : '' 
     ), 
     (
      ('on' === $show_author && 'on' === $show_date) 
       ? ' ' 
       : '' 
     ), 
     (
      'on' === $show_date 
       ? et_get_safe_localization(sprintf(__('%s', 'et_builder'), '<span class="published">' . esc_html(get_the_date($meta_date)) . '</span>')) 
       : '' 
     ), 
     (
      (('on' === $show_author || 'on' === $show_date) && 'on' === $show_categories) 
       ? ' ' 
       : '' 
     ), 
     (
      'on' === $show_categories 
       ? get_the_category_list(', ') 
       : '' 
     ), 
     (
      (('on' === $show_author || 'on' === $show_date || 'on' === $show_categories) && 'on' === $show_comments) 
       ? ' ' 
       : '' 
     ), 
     (
      'on' === $show_comments 
       ? sprintf(esc_html(_nx('1 Comment', '<span class="comments">%s Comments</span>', get_comments_number(), 'number of comments', 'et_builder')), number_format_i18n(get_comments_number())) 
       : '' 
     ) 
    ); 
} 

echo '<div class="post-content">'; 

$post_content = get_the_content(); 

// do not display the content if it contains Blog, Post Slider, Fullwidth Post Slider, or Portfolio modules to avoid infinite loops 
if (! has_shortcode($post_content, 'et_pb_blog') && ! has_shortcode($post_content, 'et_pb_portfolio') && ! has_shortcode($post_content, 'et_pb_post_slider') && ! has_shortcode($post_content, 'et_pb_fullwidth_post_slider')) { 
    if ('on' === $show_content) { 
     global $more; 

     // page builder doesn't support more tag, so display the_content() in case of post made with page builder 
     if (et_pb_is_pagebuilder_used(get_the_ID())) { 
      $more = 1; 
      the_content(); 
     } else { 
      $more = null; 
      the_content(esc_html__('read more...', 'et_builder')); 
     } 
    } else { 
     if (has_excerpt()) { 
      the_excerpt(); 
     } else { 
      echo wpautop(truncate_post(270, false)); 
     } 
    } 
} else if (has_excerpt()) { 
    the_excerpt(); 
} 

if ('on' !== $show_content) { 
    $more = 'on' == $show_more ? sprintf(' <a href="%1$s" class="more-link" >%2$s</a>' , esc_url(get_permalink()), esc_html__('read more', 'et_builder')) : ''; 
    echo $more; 
} 

echo '</div>'; 
?> 

私はカスタムのdiviモジュールを作成して、html/cssでできなかったブログポストモジュールに機能を追加しています。htmlをプレーンテキストとして出力するためのカスタムブログモジュール

'on' === $show_comments 
    ? sprintf(esc_html(_nx('1 Comment', '<span class="comments">%s Comments</span>', get_comments_number(), 'number of comments', 'et_builder')), number_format_i18n(get_comments_number())) 
    : '' 

この行は、ここで私はクラスでラップすることを必要としている、生のテキストとして<span class="comments">%s Comments</span>を出力します。希望の結果を得るためにこれをどのようにフォーマットしますか?

答えて

0

こんにちは、私はそれが遅すぎるか、あなたが問題を解決するために管理しているかわかりません。同じ問題に直面している人たちのために、私の代わりに完全なタグを使用する人は、wp-content/themes/Divi 3 2/includes/builder/main-modules.php行12284にあります。

関連する問題