1

我正在尝试在我的 Wordpress 博客上编辑帖子元数据以包括:

作者(无链接) 日期(无链接) 页面(带有指向我网站页面的附属链接)

在每个帖子标题下。

我正在使用 Activello 主题并安装了一个子主题。我正在尝试创建一个函数来执行此帖子元数据。

这就是现在的内容(这个帖子的作者和日期带有链接):

if ( ! function_exists( 'activello_posted_on' ) ) :
  function activello_posted_on() {
    printf( '<div class="post-meta"><a href="%1$s">%2$s</a> <a href="%3$s">%4$s</a></div>',
      esc_url( get_permalink() ),
      esc_html( get_the_date() ),
      esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
      get_the_author()
    );
  }
endif;

我试图解决这个问题,但我的代码仍然有问题,因为我遇到了错误。请帮忙!

     if ( ! function_exists( 'activello_posted_on' ) ) :
      function activello_posted_on() {
        printf( __(‘%1$s by %2$s <a href=“%3$s”&gt;%4$s</a>’),
          get_the_date(), 
          get_the_author(),
          esc_url( get_permalink() ),
          esc_html( '<a href="http://www.diyandkawa.com/legalities/“&gt;This post contains affiliate links.</a>' );

    );
  }
endif;

如果有人可以请帮助,我将不胜感激!

4

0 回答 0