Inhalt in Meta-Zeile eines WP-Themes einfügen

HorstSchulte

Grünschnabel
Hallo,

ich würde gerne in die Meta-Zeile meines neuen Wordpress-Themes einen weiteren Inhalt einfügen. Leider kenne ich mich mit PHP aber so gar nicht aus. Den Abschnitt, in den die Inhalt eingefügt werden müssten, habe ich entdeckt aber ich komme einfach nicht zum Ziel.

Das wäre das Element, das ich gern integriert hätte:
PHP:
<div class="entry-views">Bisher <?php
if ( is_single() ) { ?> <?php setPostViews(get_the_ID()); echo getPostViews(get_the_ID());?><?php }?></div>

Herzlichen Dank für Hilfe.

Viele Grüße
Horst


Der Quellecode des entsprechenden Abschnitts sieht so aus:
PHP:
if ( ! function_exists( 'x_renew_entry_meta' ) ) :
  function x_renew_entry_meta() {

    $author = sprintf( '<span>%s</span>',
      get_the_author()
    );

    $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( 'd.m.Y' ) )
    );

    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( __( "Alle Artikel in: &ldquo;%s&rdquo;", '__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( __( "Alle Artikel in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                            . '">'
                            . $category->name
                            . '</a>'
                            . $separator;
      }

      $categories_list = sprintf( '<span>%s</span>',
        trim( $categories_output, $separator )
      );
    }

    if ( comments_open() ) {
      $title  = get_the_title();
      $link   = get_comments_link();
      $number = get_comments_number();
      if ( $number == 0 ) {
        $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
          esc_url( $link ),
          esc_attr( sprintf( __( 'Kommentar schreiben: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
          __( 'Kommentar schreiben' , '__x__' )
        );
      } else if ( $number == 1 ) {
        $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
          esc_url( $link ),
          esc_attr( sprintf( __( 'Kommentar schreiben: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
          $number . ' ' . __( 'Kommentar' , '__x__' )
        );
      } else {
        $comments = sprintf( '<span><a href="%1$s" title="%2$s" class="meta-comments">%3$s</a></span>',
          esc_url( $link ),
          esc_attr( sprintf( __( 'Kommentar schreiben: &ldquo;%s&rdquo;', '__x__' ), $title ) ),
          $number . ' ' . __( 'Kommentare' , '__x__' )
        );
      }
    } else {
      $comments = '';
    }

    $post_type           = get_post_type();
    $post_type_post      = $post_type == 'post';
    $post_type_portfolio = $post_type == 'x-portfolio';
    $no_post_meta        = get_theme_mod( 'x_blog_enable_post_meta' ) == 0;
    $no_portfolio_meta   = get_theme_mod( 'x_portfolio_enable_post_meta' ) == 0;

    if ( $post_type_post && $no_post_meta || $post_type_portfolio && $no_portfolio_meta ) {
      return;
    } else {
      printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
        $author,
        $date,
        $categories_list,
        $comments
      
      );
    }

  }
endif;
 
Zuletzt bearbeitet von einem Moderator:

Neue Beiträge

Zurück