Arkadaşlar merhaba. Php konusunda biraz yardıma ihtiyacım var. Belki buradan bir arkadaşımız yardımcı olabilir düşüncesiyle konu açtım.

Kullandığım temada;

<?php sydney_posted_on(); ?> ile konu içi Tarih ve Yazar gösteriliyor. Buraya kadar sorun yok.

function sydney_posted_on() {
	$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
	if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
		$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
	}

	$time_string = sprintf( $time_string,
		esc_attr( get_the_date( 'c' ) ),
		esc_html( get_the_date() ),
		esc_attr( get_the_modified_date( 'c' ) ),
		esc_html( get_the_modified_date() )
	);

	$posted_on = sprintf(
		_x( 'Posted %s', 'post date', 'sydney' ),
		'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
	);

	$byline = sprintf(
		_x( '%s', 'post author', 'sydney' ),
		'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
	);

	echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
	
	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
		echo '<span class="comments-link">';
		comments_popup_link( __( 'Leave a comment', 'sydney' ), __( '1 Comment', 'sydney' ), __( '% Comments', 'sydney' ) );
		echo '</span>';
	}

	$categories_list = get_the_category_list( __( ', ', 'sydney' ) );
	if ( !is_single() && $categories_list && sydney_categorized_blog() ) {
		printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'sydney' ) . '</span>', $categories_list );
	}
}
endif;

Yapmak istediğim:

Arkadaşlar 1 kod var ve siteler için oldukça faydalı.
Buna göre örneğin yazıyı yayınladık normalde yayınlanan tarihi gösterir, güncelleme yapsanız bile o eski tarih kalır. Bu kod ile eğer yazı güncellenirse o tarih gösteriyor ve böylece Google aramalarda o tarih gösteriliyor. Bu da siteye giren için önemli! Bakıyor konu yeni yazılmış gibi görüyor.

B kodlar 2 side çalışıyor sorun yok.

2 kod var aynı işi görüyor biri function biri php

function show_last_modified_date( $content ) {
$original_time = get_the_time('U');
$modified_time = get_the_modified_time('U');
if ($modified_time >= $original_time + 86400) {
$updated_time = get_the_modified_time('h:i a');
$updated_day = get_the_modified_time('F jS, Y');
$modified_content .= '<p class="last-modified">This post was most recently updated on '. $updated_day . '</p>';
}
$modified_content .= $content;
return $modified_content;
}
add_filter( 'the_content', 'show_last_modified_date' );

<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "Last updated on ";
the_modified_time('F jS, Y');
echo ", "; }
else {echo "Posted on "; the_time('F jS, Y');} ?>

İlk yayınladığım fonksiyon kodunda nasıl bir değişiklik yapılmalı ki bu sistemi kendi temamda kendi fonsiyonuyla <?php sydney_posted_on(); ?> ile kullanabileyim.

Aslında alttaki bulunan 2 kodu kullanabilirim ama bu kez sayfalarda yazar çıkamayacak onun içinde ek eklenti kullanmak gerekecek. Eklenti kullanmadan temanın kendi özelliğini kullanmak istedim.

Teşekkürler.