Wordpress Beans Framework İçin Ufak İpuçları

Geçtiğimiz günlerde sırf canım sıkıldığı için Wordpress geçeyim dedim. Bunu yaparkende sade tema aradım taradım bulamadım. Sonra frameworklere göz atayım dedim ve sadeliği hoşuma giden Beans ile karşılaştım. Ama ön tanımlı olarak postların tüm içeriğini gösteriyordu. Bende bunların bir kısmını gösterip geri kalanı için ise Devamını Oku... yaptım. Böylelikle kalabalıklıktanda kurtulmuş oldum. Ayrıca Gtmetrix değerlerininde normale dönmesini sağladım.

// Kategorilerde Devamını oku yapalım
add_filter( 'the_content', 'example_category_truncated_content' );

function example_category_truncated_content( $content ) {

    // Only truncate for category view.
    if ( is_category() ) {
        // Return truncated content and readmore.
        return '<p>' . wp_trim_words( $content, 40, '...' ) . '</p><p>' . beans_post_more_link() . '</p>';
    }

    return $content;

}

// Sayfalarda Devamını oku yapalım
add_filter( 'the_content', 'example_post_truncated_content' );

function example_post_truncated_content( $content ) {

    if ( is_home() ) {
        // Return truncated content and readmore.
        return '<p>' . wp_trim_words( $content, 40, '...' ) . '</p><p>' . beans_post_more_link() . '</p>';
    }

    return $content;

}

// Font seçimi
add_action( 'wp_enqueue_scripts', 'example_assets' );
/**
 * Enqueue assets.
 */
function example_assets() {
    wp_enqueue_style( 'open-sans', 'https://fonts.googleapis.com/css?family=Open+Sans' );
}

Daha sonra Dil ve Copyright mesajlarını halletmemiz gerekiyor. Yoksa direk olarak Read more... olarak gözükecek isterseniz bu şekildede bırakabilirsiniz. Tercih size ait

add_filter( 'beans_footer_credit_right_text_output', 'example_footer_credit_right_text' );

function example_footer_credit_right_text() {

	return 'Linux Hacısı';

}

add_filter( 'beans_post_more_link_text_output', 'example_modify_read_more' );

function example_modify_read_more() {

   return 'Devamını Oku...';
   
}

Ayrıca Beans oldukça sade bir tasarıma sahiptir wordpress için tema geliştirmenize oldukça güzel bir şekilde imkan sağlar.

Beans Framework

dipnot: Beans open source olarak geliştirilen bir tema projesidir. Bazı projeler için framework görevide görmektedir.

Sistem Uzmanı, Linux Hacısı, El-Kernel

Yorum yapın