Advertisement
Guest User

Untitled

a guest
Apr 8th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.68 KB | None | 0 0
  1.  
  2.  
  3. <?php
  4. function childtheme_cat_limited_blog( $query ) {
  5. if ( $query->is_home() && $query->is_main_query() ) {
  6. $query->set( 'cat', '1' );
  7. }
  8. }
  9. add_action( 'pre_get_posts', 'childtheme_cat_limited_blog' );
  10.  
  11. /**
  12. * Custom Child Theme Functions
  13. *
  14. * This file's parent directory can be moved to the wp-content/themes directory
  15. * to allow this Child theme to be activated in the Appearance - Themes section of the WP-Admin.
  16. *
  17. * Included is a basic theme setup that will add support for custom header images and custom
  18. * backgrounds. There are also a set of commented theme supports that can be uncommented if you need
  19. * them for backwards compatibility. If you are starting a new theme, these legacy functionality can be deleted.
  20. *
  21. * More ideas can be found in the community documentation for Thematic
  22. * @link http://docs.thematictheme.com
  23. *
  24. * @package ThematicSampleChildTheme
  25. * @subpackage ThemeInit
  26. */
  27.  
  28.  
  29. /**
  30. * Define theme setup
  31. */
  32. function childtheme_setup() {
  33.  
  34. /* The Following add_theme_support functions
  35. * will enable legacy Thematic Features
  36. * if uncommented.
  37. */
  38.  
  39. // add_theme_support( 'thematic_legacy_feedlinks' );
  40. // add_theme_support( 'thematic_legacy_body_class' );
  41. // add_theme_support( 'thematic_legacy_post_class' );
  42. // add_theme_support( 'thematic_legacy_comment_form' );
  43. // add_theme_support( 'thematic_legacy_comment_handling' );
  44.  
  45.  
  46. /*
  47. * Add support for custom background
  48. *
  49. * Allow users to specify a custom background image or color.
  50. * Requires at least WordPress 3.4
  51. *
  52. * @link http://codex.wordpress.org/Custom_Backgrounds Custom Backgrounds
  53. */
  54. add_theme_support( 'custom-background' );
  55.  
  56.  
  57. /**
  58. * Add support for custom headers
  59. *
  60. * Customize to match your child theme layout and style.
  61. * Requires at least WordPress 3.4
  62. *
  63. * @link http://codex.wordpress.org/Custom_Headers Custom Headers
  64. */
  65. add_theme_support( 'custom-header', array(
  66. // Header image default
  67. 'default-image' => '',
  68. // Header text display default
  69. 'header-text' => true,
  70. // Header text color default
  71. 'default-text-color' => '000',
  72. // Header image width (in pixels)
  73. 'width' => '940',
  74. // Header image height (in pixels)
  75. 'height' => '235',
  76. // Header image random rotation default
  77. 'random-default' => false,
  78. // Template header style callback
  79. 'wp-head-callback' => 'childtheme_header_style',
  80. // Admin header style callback
  81. 'admin-head-callback' => 'childtheme_admin_header_style'
  82. )
  83. );
  84.  
  85. }
  86. add_action('thematic_child_init', 'childtheme_setup');
  87.  
  88.  
  89. /**
  90. * Custom Image Header Front-End Callback
  91. *
  92. * Defines the front-end style definitions for
  93. * the custom image header.
  94. * This style declaration will be output in the <head> of the
  95. * document just before the closing </head> tag.
  96. * Inline Syles and !important declarations
  97. * can be used to override these styles.
  98. *
  99. * @link http://codex.wordpress.org/Function_Reference/get_header_image get_header_image()
  100. * @link http://codex.wordpress.org/Function_Reference/get_header_textcolor get_header_textcolor()
  101. */
  102. function childtheme_header_style() {
  103. ?>
  104. <style type="text/css">
  105. <?php
  106. /* Declares the header image from the settings
  107. * saved in WP-Admin > Appearance > Header
  108. * as the background-image for div#branding.
  109. */
  110. if ( get_header_image() && HEADER_IMAGE != get_header_image() ) {
  111. ?>
  112. #branding {
  113. background:url('<?php header_image(); ?>') no-repeat 0 100%;
  114. margin-bottom:28px;
  115. padding:44px 0 <?php echo HEADER_IMAGE_HEIGHT; ?>px 0; /* Bottom padding is the same height as the image */
  116. overflow: visible;
  117. }
  118. }
  119. <?php if ( 'blank' != get_header_textcolor() ) { ?>
  120. #blog-title, #blog-title a {
  121. color:#000;
  122. }
  123. #blog-description {
  124. padding-bottom: 22px;
  125. }
  126. <?php
  127. }
  128.  
  129. }
  130. ?>
  131. <?php
  132. /* This delcares text color for the Blog title and Description
  133. * from the settings saved in WP-Admin > Appearance > Header\
  134. * If not set the deafault color is set to #000
  135. */
  136. if ( get_header_textcolor() ) {
  137. ?>
  138. #blog-title, #blog-title a, #blog-description {
  139. color:#<?php header_textcolor(); ?>;
  140. }
  141. <?php
  142. }
  143. /* Removes header text if the
  144. * "Do not diplay header text…" setting is saved
  145. * in WP-Admin > Appearance > Header
  146. */
  147. if ( ! display_header_text() ) {
  148. ?>
  149. #branding {
  150. background-position: center bottom;
  151. background-repeat: no-repeat;
  152. margin-top: 32px;
  153. }
  154. #blog-title, #blog-title a, #blog-description {
  155. display:none;
  156. }
  157. #branding {
  158. height:<?php echo HEADER_IMAGE_HEIGHT; ?>px;
  159. width:940px;
  160. padding:0;
  161. }
  162. <?php
  163. }
  164. ?>
  165. </style>
  166. <?php
  167. }
  168.  
  169.  
  170. /**
  171. * Custom Image Header Admin Callback
  172. *
  173. * Callback to defines the admin (back-end) style
  174. * definitions for the custom image header.
  175. * Customize the css to match your theme defaults.
  176. * The !important declarations override inline admin styles
  177. * to better represent a WYSIWYG of the front-end styling
  178. * that this child theme is currently designed to display.
  179. */
  180. function childtheme_admin_header_style() {
  181. ?>
  182. <style type="text/css">
  183. #headimg {
  184. background-position: left bottom;
  185. background-repeat:no-repeat;
  186. border:0 !important;
  187. height:auto !important;
  188. padding:0 0 <?php echo HEADER_IMAGE_HEIGHT + 22; /* change the added integer (22) to match your desired top padding */?>px 0;
  189. margin:0 0 28px 0;
  190. }
  191.  
  192. #headimg h1 {
  193. font-family:Arial,sans-serif;
  194. font-size:34px;
  195. font-weight:bold;
  196. line-height:40px;
  197. margin:0;
  198. }
  199. #headimg a {
  200. color: #000;
  201. text-decoration: none;
  202. }
  203. #desc{
  204. font-family: Georgia;
  205. font-size: 13px;
  206. font-style: italic;
  207. }
  208. </style>
  209. <?php
  210. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement