Advertisement
cory1990

Code

Oct 22nd, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. <?php
  2. // $style = 'post' or 'block' or 'vmenu' or 'simple'
  3. function theme_wrapper($style, $args){
  4. $func_name = "theme_{$style}_wrapper";
  5. if (function_exists($func_name)) {
  6. call_user_func($func_name, $args);
  7. } else {
  8. theme_block_wrapper($args);
  9. }
  10. }
  11.  
  12. function theme_post_wrapper($args = '') {
  13. $args = wp_parse_args($args,
  14. array(
  15. 'id' => '',
  16. 'class' => '',
  17. 'title' => '',
  18. 'thumbnail' => '',
  19. 'before' => '',
  20. 'content' => '',
  21. 'after' => ''
  22. )
  23. );
  24. extract($args);
  25. if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  26. if ($id) {
  27. $id = ' id="' . $id . '"';
  28. }
  29. if ($class) {
  30. $class = ' ' . $class;
  31. }
  32. ?>
  33. <div class="art-post<?php echo $class; ?>"<?php echo $id; ?>>
  34. <div class="art-post-body">
  35. <div class="art-post-inner art-article">
  36. <?php
  37. echo $thumbnail;
  38. if (!theme_is_empty_html($title)){
  39. echo '<h2 class="art-postheader"><img src="'.get_bloginfo('template_url').'/images/postheadericon.png" width="29" height="21" alt="" />'.$title.'</h2>';
  40. }
  41. ob_start();
  42. echo $before;
  43. $meta = ob_get_clean();
  44. if (strlen($meta) > 0) {
  45. echo '<div class="art-postmetadataheader">'.$meta.'</div>';
  46. }
  47.  
  48. ?>
  49. <div class="art-postcontent">
  50. <!-- article-content -->
  51. <?php echo $content; ?>
  52. <!-- /article-content -->
  53. </div>
  54. <div class="cleared"></div>
  55. <?php
  56. echo $after;
  57. ?>
  58. </div>
  59. <div class="cleared"></div>
  60. </div>
  61. </div>
  62.  
  63. <?php
  64. }
  65.  
  66. function theme_simple_wrapper($args = '') {
  67. $args = wp_parse_args($args,
  68. array(
  69. 'id' => '',
  70. 'class' => '',
  71. 'title' => '',
  72. 'content' => '',
  73. )
  74. );
  75. extract($args);
  76. if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  77. if ($id) {
  78. $id = ' id="' . $id . '"';
  79. }
  80. if ($class) {
  81. $class = ' ' . $class;
  82. }
  83. echo "<div class=\"art-widget{$class}\"{$id}>";
  84. if ( !theme_is_empty_html($title)) echo '<h5 class="art-widget-title">' . $title . '</h5>';
  85. echo '<div class="art-widget-content">' . $content . '</div>';
  86. echo '</div>';
  87. }
  88.  
  89. function theme_block_wrapper($args) {
  90. $args = wp_parse_args($args,
  91. array(
  92. 'id' => '',
  93. 'class' => '',
  94. 'title' => '',
  95. 'content' => '',
  96. )
  97. );
  98. extract($args);
  99. if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  100. if ($id) {
  101. $id = ' id="' . $id . '"';
  102. }
  103. if ($class) {
  104. $class = ' ' . $class;
  105. }
  106.  
  107. $begin = <<<EOL
  108. <div class="art-block{$class}"{$id}>
  109. <div class="art-block-body">
  110. EOL;
  111. $begin_title = <<<EOL
  112. <div class="art-blockheader">
  113. <h3 class="t">
  114. EOL;
  115. $end_title = <<<EOL
  116. </h3>
  117. </div>
  118. EOL;
  119. $begin_content = <<<EOL
  120. <div class="art-blockcontent">
  121. <div class="art-blockcontent-body">
  122. EOL;
  123. $end_content = <<<EOL
  124. <div class="cleared"></div>
  125. </div>
  126. </div>
  127. EOL;
  128. $end = <<<EOL
  129. <div class="cleared"></div>
  130. </div>
  131. </div>
  132. EOL;
  133. echo $begin;
  134. if ($begin_title && $end_title && !theme_is_empty_html($title)) {
  135. echo $begin_title . $title . $end_title;
  136. }
  137. echo $begin_content;
  138. echo $content;
  139. echo $end_content;
  140. echo $end;
  141. }
  142.  
  143. function theme_vmenu_wrapper($args) {
  144. $args = wp_parse_args($args,
  145. array(
  146. 'id' => '',
  147. 'class' => '',
  148. 'title' => '',
  149. 'content' => '',
  150. )
  151. );
  152. extract($args);
  153. if (theme_is_empty_html($title) && theme_is_empty_html($content)) return;
  154. if ($id) {
  155. $id = ' id="' . $id . '"';
  156. }
  157. if ($class) {
  158. $class = ' ' . $class;
  159. }
  160.  
  161. $begin = <<<EOL
  162. <div class="art-vmenublock{$class}"{$id}>
  163. <div class="art-vmenublock-body">
  164. EOL;
  165. $begin_title = <<<EOL
  166.  
  167. EOL;
  168. $end_title = <<<EOL
  169.  
  170. EOL;
  171. $begin_content = <<<EOL
  172. <div class="art-vmenublockcontent">
  173. <div class="art-vmenublockcontent-body">
  174. EOL;
  175. $end_content = <<<EOL
  176. <div class="cleared"></div>
  177. </div>
  178. </div>
  179. EOL;
  180. $end = <<<EOL
  181. <div class="cleared"></div>
  182. </div>
  183. </div>
  184. EOL;
  185. echo $begin;
  186. if ($begin_title && $end_title && !theme_is_empty_html($title)) {
  187. echo $begin_title . $title . $end_title;
  188. }
  189. echo $begin_content;
  190. echo $content;
  191. echo $end_content;
  192. echo $end;
  193. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement