Guest User

Untitled

a guest
May 24th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. add_filter('display_post_states', 'wpsites_custom_post_states');
  2.  
  3. function wpsites_custom_post_states($states) {
  4. global $post;
  5. if( ('page' == get_post_type($post->ID) )
  6. && ( '/themes/Lef-en-Liefde/woningoverzicht.php' == get_page_templ‌​ate_slug( $post->ID ) ) ) {
  7.  
  8. $states[] = __('Custom state');
  9.  
  10. }
  11. }
  12.  
  13. add_filter('display_post_states', 'wpse240081_custom_post_states');
  14.  
  15. function wpse240081_custom_post_states( $states, $post ) {
  16.  
  17. if ( ( 'page' == get_post_type( $post->ID ) )
  18. && ( 'woningoverzicht.php' == get_page_templ‌​ate_slug( $post->ID ) ) ) {
  19.  
  20. $states[] = __('Custom state');
  21.  
  22. }
  23.  
  24. return $states;
  25. }
  26.  
  27. <?php
  28. add_filter( 'display_post_states', 'add_display_post_states', 10, 2 );
  29.  
  30. /**
  31. * Add a post display state for special WC pages in the page list table.
  32. *
  33. * @param array $post_states An array of post display states.
  34. * @param WP_Post $post The current post object.
  35. */
  36. function add_display_post_states( $post_states, $post ) {
  37. if ( wc_get_page_id( 'shop' ) === $post->ID ) {
  38. $post_states['wc_page_for_shop'] = __( 'Shop Page', 'woocommerce' );
  39. }
  40.  
  41. if ( wc_get_page_id( 'cart' ) === $post->ID ) {
  42. $post_states['wc_page_for_cart'] = __( 'Cart Page', 'woocommerce' );
  43. }
  44.  
  45. if ( wc_get_page_id( 'checkout' ) === $post->ID ) {
  46. $post_states['wc_page_for_checkout'] = __( 'Checkout Page', 'woocommerce' );
  47. }
  48.  
  49. if ( wc_get_page_id( 'myaccount' ) === $post->ID ) {
  50. $post_states['wc_page_for_myaccount'] = __( 'My Account Page', 'woocommerce' );
  51. }
  52.  
  53. if ( wc_get_page_id( 'terms' ) === $post->ID ) {
  54. $post_states['wc_page_for_terms'] = __( 'Terms and Conditions Page', 'woocommerce' );
  55. }
  56.  
  57. return $post_states;
  58. }
Add Comment
Please, Sign In to add comment