PageRenderTime 57ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/blog/wp-content/themes/pilcrow/functions.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 594 lines | 348 code | 58 blank | 188 comment | 39 complexity | 3ab0eb8b836967e63d6063b6903cdbf7 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Pilcrow
  5. * @since Pilcrow 1.0
  6. */
  7. /**
  8. * Set the content width based on the theme's design and stylesheet.
  9. *
  10. * Used to set the width of images and content. Should be equal to the width the theme
  11. * is designed for, generally via the style.css stylesheet.
  12. */
  13. if ( ! isset( $content_width ) )
  14. $content_width = 500;
  15. /** Tell WordPress to run pilcrow_setup() when the 'after_setup_theme' hook is run. */
  16. add_action( 'after_setup_theme', 'pilcrow_setup' );
  17. if ( ! function_exists( 'pilcrow_setup' ) ):
  18. /**
  19. * Sets up theme defaults and registers support for various WordPress features.
  20. *
  21. * Note that this function is hooked into the after_setup_theme hook, which runs
  22. * before the init hook. The init hook is too late for some features, such as indicating
  23. * support post thumbnails.
  24. *
  25. * To override pilcrow_setup() in a child theme, add your own pilcrow_setup to your child theme's
  26. * functions.php file.
  27. *
  28. * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
  29. * @uses register_nav_menus() To add support for navigation menus.
  30. * @uses add_custom_background() To add support for a custom background.
  31. * @uses add_editor_style() To style the visual editor.
  32. * @uses load_theme_textdomain() For translation/localization support.
  33. * @uses add_custom_image_header() To add support for a custom header.
  34. * @uses register_default_headers() To register the default custom header images provided with the theme.
  35. * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  36. *
  37. * @since Pilcrow 1.0
  38. */
  39. function pilcrow_setup() {
  40. // This theme has some pretty cool theme options
  41. require( dirname( __FILE__ ) . '/theme-options.php' );
  42. // This theme uses post thumbnails
  43. add_theme_support( 'post-thumbnails' );
  44. // Add default posts and comments RSS feed links to head
  45. add_theme_support( 'automatic-feed-links' );
  46. // Make theme available for translation
  47. // Translations can be filed in the /languages/ directory
  48. load_theme_textdomain( 'pilcrow', TEMPLATEPATH . '/languages' );
  49. $locale = get_locale();
  50. $locale_file = TEMPLATEPATH . "/languages/$locale.php";
  51. if ( is_readable( $locale_file ) )
  52. require_once( $locale_file );
  53. // This theme uses wp_nav_menu() in one location.
  54. register_nav_menus( array(
  55. 'primary' => __( 'Primary Navigation', 'pilcrow' ),
  56. ) );
  57. // This theme allows users to set a custom background
  58. add_custom_background();
  59. // Your changeable header business starts here
  60. define( 'HEADER_TEXTCOLOR', '000' );
  61. // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
  62. define( 'HEADER_IMAGE', '%s/images/headers/books.jpg' );
  63. // The height and width of your custom header. You can hook into the theme's own filters to change these values.
  64. // Add a filter to pilcrow_header_image_width and pilcrow_header_image_height to change these values.
  65. $options = get_option( 'pilcrow_theme_options' );
  66. $current_layout = $options['theme_layout'];
  67. $two_columns = array( 'content-sidebar', 'sidebar-content' );
  68. if ( in_array( $current_layout, $two_columns ) ) {
  69. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'pilcrow_header_image_width', 770 ) );
  70. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'pilcrow_header_image_height', 200 ) );
  71. }
  72. else {
  73. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'pilcrow_header_image_width', 990 ) );
  74. define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'pilcrow_header_image_height', 257 ) );
  75. }
  76. // We'll be using post thumbnails for custom header images on posts and pages.
  77. // We want them to be 940 pixels wide by 198 pixels tall.
  78. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
  79. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
  80. // Add a way for the custom header to be styled in the admin panel that controls
  81. // custom headers. See pilcrow_admin_header_style(), below.
  82. add_custom_image_header( 'pilcrow_header_style', 'pilcrow_admin_header_style', 'pilcrow_admin_header_image' );
  83. // ... and thus ends the changeable header business.
  84. // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
  85. register_default_headers( array(
  86. 'books' => array(
  87. 'url' => '%s/images/headers/books.jpg',
  88. 'thumbnail_url' => '%s/images/headers/books-thumbnail.jpg',
  89. /* translators: header image description */
  90. 'description' => __( 'Books', 'pilcrow' )
  91. ),
  92. 'record' => array(
  93. 'url' => '%s/images/headers/record.jpg',
  94. 'thumbnail_url' => '%s/images/headers/record-thumbnail.jpg',
  95. /* translators: header image description */
  96. 'description' => __( 'Record', 'pilcrow' )
  97. ),
  98. 'pattern' => array(
  99. 'url' => '%s/images/headers/pattern.jpg',
  100. 'thumbnail_url' => '%s/images/headers/pattern-thumbnail.jpg',
  101. /* translators: header image description */
  102. 'description' => __( 'Pattern', 'pilcrow' )
  103. ),
  104. ) );
  105. }
  106. endif;
  107. if ( ! function_exists( 'pilcrow_header_style' ) ) :
  108. /**
  109. * Styles the header image and text displayed on the blog
  110. *
  111. * @since pilcrow 1.0
  112. */
  113. function pilcrow_header_style() {
  114. // If no custom options for text are set, let's bail
  115. // get_header_textcolor() options: HEADER_TEXTCOLOR is default, hide text (returns 'blank') or any hex value
  116. if ( HEADER_TEXTCOLOR == get_header_textcolor() )
  117. return;
  118. // If we get this far, we have custom styles. Let's do this.
  119. ?>
  120. <style type="text/css">
  121. <?php
  122. // Has the text been hidden?
  123. if ( 'blank' == get_header_textcolor() ) :
  124. ?>
  125. #site-title {
  126. position: absolute !important;
  127. clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
  128. clip: rect(1px, 1px, 1px, 1px);
  129. }
  130. #nav {
  131. margin-top: 18px;
  132. }
  133. <?php
  134. // If the user has set a custom color for the text use that
  135. else :
  136. ?>
  137. #site-title a {
  138. color: #<?php echo get_header_textcolor(); ?> !important;
  139. }
  140. <?php endif; ?>
  141. </style>
  142. <?php
  143. }
  144. endif;
  145. if ( ! function_exists( 'pilcrow_admin_header_style' ) ) :
  146. /**
  147. * Styles the header image displayed on the Appearance > Header admin panel.
  148. *
  149. * Referenced via add_custom_image_header() in pilcrow_setup().
  150. *
  151. * @since Pilcrow 1.0
  152. */
  153. function pilcrow_admin_header_style() {
  154. ?>
  155. <style type="text/css">
  156. /* Shows the same border as on front end */
  157. .appearance_page_custom-header #headimg {
  158. border: none;
  159. width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
  160. max-width: 800px;
  161. }
  162. #site-title {
  163. font-family: Georgia, serif;
  164. text-align: right;
  165. margin: 0;
  166. }
  167. #site-title a {
  168. color: #000;
  169. font-size: 40px;
  170. font-weight: bold;
  171. line-height: 72px;
  172. text-decoration: none;
  173. }
  174. #headimg img {
  175. height: auto;
  176. width: 100%;
  177. }
  178. /* If NO_HEADER_TEXT is false, you would style the text with these selectors:
  179. #headimg #name { }
  180. #headimg #desc { }
  181. */
  182. </style>
  183. <?php
  184. }
  185. endif;
  186. if ( ! function_exists( 'pilcrow_admin_header_image' ) ) :
  187. /**
  188. * Custom header image markup displayed on the Appearance > Header admin panel.
  189. *
  190. * Referenced via add_custom_image_header() in pilcrow_setup().
  191. *
  192. * @since pilcrow 1.0
  193. */
  194. function pilcrow_admin_header_image() { ?>
  195. <div id="headimg">
  196. <?php
  197. if ( 'blank' == get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) || '' == get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) )
  198. $style = ' style="display:none;"';
  199. else
  200. $style = ' style="color:#' . get_theme_mod( 'header_textcolor', HEADER_TEXTCOLOR ) . ';"';
  201. ?>
  202. <h1 id="site-title"><a id="name"<?php echo $style; ?> onclick="return false;" href="<?php bloginfo( 'url' ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
  203. <img src="<?php esc_url ( header_image() ); ?>" alt="" />
  204. </div>
  205. <?php }
  206. endif;
  207. if ( ! function_exists( 'pilcrow_background_markup' ) ) :
  208. /**
  209. * Adds a containing div around everything if the custom background feature is in use
  210. *
  211. * @since Pilcrow 1.0
  212. */
  213. function pilcrow_background_markup() {
  214. // check if we're using a custom background image or color
  215. $color = get_background_color();
  216. $image = get_background_image();
  217. if ( '' != $color || '' != $image ) {
  218. // If we are, let's hook into the pilcrow_before action
  219. function pilcrow_wrap_before() {
  220. echo '<div id="wrapper">';
  221. }
  222. add_action( 'pilcrow_before', 'pilcrow_wrap_before' );
  223. // And, let's hook into the pilcrow_after action
  224. function pilcrow_wrap_after() {
  225. echo '</div><!-- #wrapper -->';
  226. }
  227. add_action( 'pilcrow_after', 'pilcrow_wrap_after' );
  228. }
  229. }
  230. add_action( 'init', 'pilcrow_background_markup' );
  231. endif;
  232. /**
  233. * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link and only show 1 level of menu items (to match a previous theme)
  234. *
  235. * To override this in a child theme, remove the filter and optionally add
  236. * your own function tied to the wp_page_menu_args filter hook.
  237. *
  238. * @since Pilcrow 1.0
  239. */
  240. function pilcrow_page_menu_args( $args ) {
  241. $args['show_home'] = true;
  242. $args['depth'] = 1;
  243. return $args;
  244. }
  245. add_filter( 'wp_page_menu_args', 'pilcrow_page_menu_args' );
  246. /**
  247. * Sets the post excerpt length to 40 characters.
  248. *
  249. * To override this length in a child theme, remove the filter and add your own
  250. * function tied to the excerpt_length filter hook.
  251. *
  252. * @since Pilcrow 1.0
  253. * @return int
  254. */
  255. function pilcrow_excerpt_length( $length ) {
  256. return 40;
  257. }
  258. add_filter( 'excerpt_length', 'pilcrow_excerpt_length' );
  259. /**
  260. * Returns a "Continue Reading" link for excerpts
  261. *
  262. * @since Pilcrow 1.0
  263. * @return string "Continue Reading" link
  264. */
  265. function pilcrow_continue_reading_link() {
  266. return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'pilcrow' ) . '</a>';
  267. }
  268. /**
  269. * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and pilcrow_continue_reading_link().
  270. *
  271. * To override this in a child theme, remove the filter and add your own
  272. * function tied to the excerpt_more filter hook.
  273. *
  274. * @since Pilcrow 1.0
  275. * @return string An ellipsis
  276. */
  277. function pilcrow_auto_excerpt_more( $more ) {
  278. return ' &hellip;' . pilcrow_continue_reading_link();
  279. }
  280. add_filter( 'excerpt_more', 'pilcrow_auto_excerpt_more' );
  281. /**
  282. * Adds a pretty "Continue Reading" link to custom post excerpts.
  283. *
  284. * To override this link in a child theme, remove the filter and add your own
  285. * function tied to the get_the_excerpt filter hook.
  286. *
  287. * @since Pilcrow 1.0
  288. * @return string Excerpt with a pretty "Continue Reading" link
  289. */
  290. function pilcrow_custom_excerpt_more( $output ) {
  291. if ( has_excerpt() && ! is_attachment() ) {
  292. $output .= pilcrow_continue_reading_link();
  293. }
  294. return $output;
  295. }
  296. add_filter( 'get_the_excerpt', 'pilcrow_custom_excerpt_more' );
  297. if ( ! function_exists( 'pilcrow_comment' ) ) :
  298. /**
  299. * Template for comments and pingbacks.
  300. *
  301. * To override this walker in a child theme without modifying the comments template
  302. * simply create your own pilcrow_comment(), and that function will be used instead.
  303. *
  304. * Used as a callback by wp_list_comments() for displaying the comments.
  305. *
  306. * @since Pilcrow 1.0
  307. */
  308. function pilcrow_comment( $comment, $args, $depth ) {
  309. $GLOBALS['comment'] = $comment;
  310. switch ( $comment->comment_type ) :
  311. case '' :
  312. ?>
  313. <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
  314. <div id="comment-<?php comment_ID(); ?>" class="comment-container">
  315. <div class="comment-author vcard">
  316. <?php echo get_avatar( $comment, 48 ); ?>
  317. <?php printf( __( '%s', 'pilcrow' ), sprintf( '<cite class="fn">%s</cite>', get_comment_author_link() ) ); ?>
  318. </div><!-- .comment-author .vcard -->
  319. <?php if ( $comment->comment_approved == '0' ) : ?>
  320. <em><?php _e( 'Your comment is awaiting moderation.', 'pilcrow' ); ?></em>
  321. <br />
  322. <?php endif; ?>
  323. <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">
  324. <?php
  325. /* translators: 1: date, 2: time */
  326. printf( __( '%1$s at %2$s', 'pilcrow' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)', 'pilcrow' ), ' ' );
  327. ?>
  328. </div><!-- .comment-meta .commentmetadata -->
  329. <div class="comment-body"><?php comment_text(); ?></div>
  330. <div class="reply">
  331. <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
  332. </div><!-- .reply -->
  333. </div><!-- #comment-## -->
  334. <?php
  335. break;
  336. case 'pingback' :
  337. case 'trackback' :
  338. ?>
  339. <li class="post pingback">
  340. <p><?php _e( 'Pingback:', 'pilcrow' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'pilcrow' ), ' ' ); ?></p>
  341. <?php
  342. break;
  343. endswitch;
  344. }
  345. endif;
  346. /**
  347. * Register widgetized areas, including two sidebars and two widget-ready columns in the footer.
  348. *
  349. * To override pilcrow_widgets_init() in a child theme, remove the action hook and add your own
  350. * function tied to the init hook.
  351. *
  352. * @since Pilcrow 1.0
  353. * @uses register_sidebar
  354. */
  355. function pilcrow_widgets_init() {
  356. // Area 1, located at the top of the sidebar.
  357. register_sidebar( array(
  358. 'name' => __( 'Sidebar', 'pilcrow' ),
  359. 'id' => 'sidebar-1',
  360. 'description' => __( 'The main sidebar', 'pilcrow' ),
  361. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  362. 'after_widget' => '</li>',
  363. 'before_title' => '<h3 class="widget-title">',
  364. 'after_title' => '</h3>',
  365. ) );
  366. // Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
  367. register_sidebar( array(
  368. 'name' => __( 'Secondary Sidebar', 'pilcrow' ),
  369. 'id' => 'sidebar-2',
  370. 'description' => __( 'The secondary sidebar in three-column layouts', 'pilcrow' ),
  371. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  372. 'after_widget' => '</li>',
  373. 'before_title' => '<h3 class="widget-title">',
  374. 'after_title' => '</h3>',
  375. ) );
  376. // Area 3, located above the primary and secondary sidebars in Content-Sidebar-Sidebar and Sidebar-Sidebar-Content layouts. Empty by default.
  377. register_sidebar( array(
  378. 'name' => __( 'Feature Area', 'pilcrow' ),
  379. 'id' => 'sidebar-3',
  380. 'description' => __( 'The feature widget area above the sidebars in Content-Sidebar-Sidebar and Sidebar-Sidebar-Content layouts', 'pilcrow' ),
  381. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  382. 'after_widget' => '</li>',
  383. 'before_title' => '<h3 class="widget-title">',
  384. 'after_title' => '</h3>',
  385. ) );
  386. // Area 4, located in the footer. Empty by default.
  387. register_sidebar( array(
  388. 'name' => __( 'First Footer Area', 'pilcrow' ),
  389. 'id' => 'sidebar-4',
  390. 'description' => __( 'The first footer widget area', 'pilcrow' ),
  391. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  392. 'after_widget' => '</li>',
  393. 'before_title' => '<h3 class="widget-title">',
  394. 'after_title' => '</h3>',
  395. ) );
  396. // Area 5, located in the footer. Empty by default.
  397. register_sidebar( array(
  398. 'name' => __( 'Second Footer Area', 'pilcrow' ),
  399. 'id' => 'sidebar-5',
  400. 'description' => __( 'The second footer widget area', 'pilcrow' ),
  401. 'before_widget' => '<li id="%1$s" class="widget %2$s">',
  402. 'after_widget' => '</li>',
  403. 'before_title' => '<h3 class="widget-title">',
  404. 'after_title' => '</h3>',
  405. ) );
  406. }
  407. /** Register sidebars by running pilcrow_widgets_init() on the widgets_init hook. */
  408. add_action( 'widgets_init', 'pilcrow_widgets_init' );
  409. /**
  410. * Returns the current pilcrow color scheme as selected in the theme options
  411. *
  412. * @since pilcrow 1.0
  413. */
  414. function pilcrow_current_color_scheme() {
  415. $options = get_option( 'pilcrow_theme_options' );
  416. return $options['color_scheme'];
  417. }
  418. /**
  419. * Register our color schemes and add them to the queue
  420. */
  421. function pilcrow_color_registrar() {
  422. $color_scheme = pilcrow_current_color_scheme();
  423. if ( 'dark' == pilcrow_current_color_scheme() ) {
  424. wp_register_style( 'dark', get_template_directory_uri() . '/colors/dark.css', null, null );
  425. wp_enqueue_style( 'dark' );
  426. }
  427. if ( 'brown' == pilcrow_current_color_scheme() ) {
  428. wp_register_style( 'brown', get_template_directory_uri() . '/colors/brown.css', null, null );
  429. wp_enqueue_style( 'brown' );
  430. }
  431. if ( 'red' == pilcrow_current_color_scheme() ) {
  432. wp_register_style( 'red', get_template_directory_uri() . '/colors/red.css', null, null );
  433. wp_enqueue_style( 'red' );
  434. }
  435. }
  436. add_action( 'wp_print_styles', 'pilcrow_color_registrar' );
  437. /**
  438. * Returns the current pilcrow layout as selected in the theme options
  439. *
  440. * @since pilcrow 1.0
  441. */
  442. function pilcrow_current_layout() {
  443. $options = get_option( 'pilcrow_theme_options' );
  444. $current_layout = $options['theme_layout'];
  445. $two_columns = array( 'content-sidebar', 'sidebar-content' );
  446. $three_columns = array( 'content-sidebar-sidebar', 'sidebar-sidebar-content', 'sidebar-content-sidebar' );
  447. if ( in_array( $current_layout, $two_columns ) )
  448. return 'two-column ' . $current_layout;
  449. elseif ( in_array( $current_layout, $three_columns ) )
  450. return 'three-column ' . $current_layout;
  451. else
  452. return $current_layout;
  453. }
  454. /**
  455. * Adds pilcrow_current_layout() to the array of body classes
  456. *
  457. * @since pilcrow 1.0
  458. */
  459. function pilcrow_body_class($classes) {
  460. $classes[] = pilcrow_current_layout();
  461. return $classes;
  462. }
  463. add_filter( 'body_class', 'pilcrow_body_class' );
  464. /**
  465. * Set the default theme colors based on the current color scheme
  466. */
  467. $color_scheme = pilcrow_current_color_scheme();
  468. switch ( $color_scheme ) {
  469. case 'dark':
  470. $themecolors = array(
  471. 'bg' => '0a0a0a',
  472. 'border' => '282828',
  473. 'text' => 'd8d8cd',
  474. 'link' => '1c9bdc',
  475. 'url' => '1c9bdc'
  476. );
  477. break;
  478. case 'brown':
  479. $themecolors = array(
  480. 'bg' => '29241b',
  481. 'border' => '3a3121',
  482. 'text' => '9f9c80',
  483. 'link' => 'b58942',
  484. 'url' => 'b58942'
  485. );
  486. break;
  487. case 'red':
  488. $themecolors = array(
  489. 'bg' => 'b62413',
  490. 'border' => 'e23817',
  491. 'text' => 'fae8e6',
  492. 'link' => 'b58942',
  493. 'url' => 'b58942'
  494. );
  495. break;
  496. default:
  497. $themecolors = array(
  498. 'bg' => 'ffffff',
  499. 'border' => 'bbbbbb',
  500. 'text' => '333333',
  501. 'link' => '1c9bdc',
  502. 'url' => '1c9bdc'
  503. );
  504. break;
  505. }
  506. /**
  507. * Show a nice admin message saying Pilcrow replaced PressRow
  508. */
  509. function pilcrow_change_notice() {
  510. $custom_css_link = admin_url() . 'themes.php?page=editcss';
  511. $hide_link = wp_nonce_url( admin_url( 'themes.php?hide-switch-note=true' ), 'hide_switch_note' )
  512. ?>
  513. <div class="updated">
  514. <p style="line-height: 1.5em;">Your site was automatically upgraded to a new theme called Pilcrow.
  515. <?php if ( ! defined( 'SAFECSS_ACTIVATED' ) || constant( 'SAFECSS_ACTIVATED' ) !== true ) : ?>
  516. <a href="http://blog.wordpress.com/new-theme-pilcrow/">Read more about Pilcrow</a> or learn about the theme change in <a href="http://en.forums.wordpress.com/topic/details-on-pressrow-replacement-pilcrow">our announcement</a>.</p>
  517. <?php else: ?>
  518. <br /><strong>Custom CSS:</strong> Since you&rsquo;re using <a href="<?php echo $custom_css_link; ?>">Custom CSS</a> on your blog, you may want to check out the theme changes in <a href="http://en.forums.wordpress.com/topic/details-on-pressrow-replacement-pilcrow">our announcement</a>. The changes in the new theme may affect the way your <a href="<?php echo $custom_css_link; ?>">Custom CSS</a> works.</p>
  519. <?php endif; ?>
  520. <p style="line-height: 1.5em;">( <a href="<?php echo $hide_link; ?>">Don't show this message again</a>. )</p>
  521. </div>
  522. <?php
  523. }
  524. // Only show admin note if this was an automated switch
  525. $hide_switch_note = get_theme_mod( 'hide_switch_note' );
  526. if ( false !== get_option( 'pressrow_sidebars_widgets_bak' ) && empty( $hide_switch_note ) ) {
  527. remove_action( 'admin_notices', 'show_tip' );
  528. add_action( 'admin_notices', 'pilcrow_change_notice' );
  529. }
  530. // Process the "Don't show this message again" action
  531. if ( isset( $_GET['hide-switch-note'] ) ) {
  532. check_admin_referer( 'hide_switch_note' );
  533. set_theme_mod( 'hide_switch_note', true );
  534. wp_redirect( admin_url( 'themes.php' ) ); // reload the page
  535. }