Turgenyev adlı üyeden alıntı: mesajı görüntüle
sağ olun hocam.. geçerli yılı mı ekliyor bu kodla? ben istediğim yılı yapmak istiyorum. örneğin 2020-2021 gibi bir sonraki sene 2021-2022 gibi.
function ecan_custom_title( $title, $sep ) {
return str_replace("%%year%%"," ".get_option("categoryyear"),$title);
}
add_filter( 'wp_title', 'ecan_custom_title', 9999, 2 );
function ecan_custom_option(){
$option_group = 'permalink';
$option_name = 'categoryyear';
$sanitize_callback = null;
register_setting( $option_group, $option_name, $sanitize_callback );

$id = 'categoryyear';
$title = __("Kategori Başlık Eki","ecancan");
$callback = 'ecan_custom_option_html';
$page = 'permalink';
$section = 'optional';
$args = null;
add_settings_field( $id, $title, $callback, $page, $section, $args );
}
add_action( 'admin_init', 'ecan_custom_option' );
function ecan_custom_option_html(){
$option = 'categoryyear';
echo '<input type="text" name="' . $option . '" id="' . $option . '" value="' . get_option( $option ) . '" class="regular-text ltr" />';
}
function ecan_custom_save_option(){
if( isset($_POST['permalink_structure']) && isset( $_POST['categoryyear'] ) ){
$short_domain = wp_unslash( $_POST['categoryyear'] );
update_option( 'categoryyear', $short_domain );
}
}
add_action( 'admin_init', 'ecan_custom_save_option' );
Bu kodu ekledikten sonra kalıcı bağlantılar ksımında bir ek ayar göreceksiniz oraya girdiğiniz herhangi bir içerik kategorilere ek olarak yansıyacak.