I am very new to PHP. As a graphic designer it is hard for us to conceptualize PHP and back-end codes to do what we envision, so please go easy on me. :) It doesn't come naturally to people like me.
I have a block of code that I want to call into my theme in the efforts of minimalizing the front-end.
<title>
<? global $page, $paged; wp_title( '|', true, 'right' ); bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'framework' ), max( $paged, $page ) );?>
</title>
I need to make it cleaner. Example:
<title>
<? require(TEMPLATEPATH . '/library/clean.php', 'FUNCTION_NAME_TO_CALL')
</title>
- Am I able to place the code within directly into a function?
- Am I able to require() the clean.php and tell that require() to only use a specific function? If so how?
If my logic in doing this is wrong then please let me know, I am eager to learn.