Created
March 7, 2011 14:01
-
-
Save marcboivin/858535 to your computer and use it in GitHub Desktop.
Exemple de functions.php comme une étape entre le controlleur et la view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Methods used to build the theme's templates. These methods encapsulate the | |
* verifications and fallbacks that account for the availability of plugins, | |
* configuration options, or PHP/WordPress features. | |
*/ | |
class Theme | |
{ | |
/** | |
* Displays alternative search results, if available. | |
*/ | |
public static function alternative_search_results() | |
{ | |
if (class_exists(Search)) | |
{ | |
Search::suggest_alternative_results(); | |
} | |
} | |
/** | |
* Displays the profile of the current idea's author, if available. | |
*/ | |
public static function author_profile() | |
{ | |
if (method_exists(Profile, get_control)) | |
{ | |
echo ' | |
<div | |
class="author user_profile"> | |
' . Profile::get_control() . ' | |
</div> | |
'; | |
} | |
} | |
/** | |
* Displays a class attribute for the body tag, appending the navigation | |
* mode to the list of classes. | |
*/ | |
public static function body_class_nav_mode() | |
{ | |
global $ma14_nav_mode; | |
body_class($ma14_nav_mode); | |
} | |
/** | |
* Displays the comments control, if available. | |
*/ | |
public static function comments_control() | |
{ | |
global $wp_query; | |
if (function_exists(ma14_comments_template)) | |
{ | |
// If there is only one post, we force comments on it. | |
$force = 1 === $wp_query->post_count; | |
custom_comments_template($force); | |
} | |
} | |
} |
Author
marcboivin
commented
Mar 7, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment