Guest User

Untitled

a guest
Sep 23rd, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. <?php
  2. /**
  3. * Custom functions
  4. */
  5.  
  6. // Add Block Template to existing portfolio post type
  7. function bbp_add_portfolio_template() {
  8. $post_type_object = get_post_type_object( 'portfolio' );
  9. $post_type_object->show_in_rest = true;
  10. $post_type_object->rest_base = 'portfolio';
  11. $post_type_object->template = array(
  12. array( 'core/heading', array(
  13. 'placeholder' => 'Executive Summary',
  14. 'level' => '2',
  15. )
  16. ),
  17. array( 'core/paragraph', array(
  18. 'placeholder' => 'Put the problem and the results you got into about 160 characters, with keywords. Then you can use it for your meta description.',
  19. 'customFontSize' => '24',
  20. )
  21. ),
  22. array( 'core/columns',
  23. array(
  24. 'align' => 'wide',
  25. 'columns' => '2',
  26. ),
  27. array(
  28. array( 'core/column', array(), array(
  29. array( 'core/image', array() ),
  30. ) ),
  31. array( 'core/column', array(), array(
  32. array( 'core/heading', array(
  33. 'placeholder'=> 'Client Company Name',
  34. 'level' => '3',
  35. ) ),
  36. array( 'core/paragraph', array(
  37. 'placeholder' => 'Describe your client: industry, company size, who their customer is, what they do.',
  38. ) ),
  39. ) ),
  40. ) ),
  41. array('core/quote', array(
  42. ) ),
  43. array( 'core/heading', array(
  44. 'placeholder' => 'The Challenge',
  45. 'level' => '2',
  46. ) ),
  47. array( 'core/paragraph', array(
  48. 'placeholder' => 'Why did your client need your services?',
  49. ) ),
  50. array( 'core/image', array(
  51. 'align' => 'wide',
  52. ) ),
  53. array( 'core/heading', array(
  54. 'placeholder' => 'Your Solution',
  55. 'level' => '2',
  56. ) ),
  57. array( 'core/paragraph', array(
  58. 'placeholder' => 'Write two or three short paragraphs describing what you did to solve the problem.',
  59. ) ),
  60. array( 'core/image', array(
  61. 'align' => 'wide',
  62. ) ),
  63. array( 'core/heading', array(
  64. 'placeholder' => 'Results and ROI',
  65. 'level' => '2',
  66. ) ),
  67. array( 'core/paragraph', array(
  68. 'placeholder' => 'You need a keyword-rich sound bite with numbers in it, e.g. tripled revenue or cut production time in half.',
  69. 'customFontSize' => '20',
  70. 'customTextColor' => '#FF6900',
  71.  
  72. ) ),
  73. array( 'core/paragraph', array(
  74. 'placeholder' => 'Provide more detail about how happy the client is and why. You could put another quote here instead.',
  75. ) ),
  76. array( 'core/image', array(
  77. 'align' => 'wide',
  78. ) ),
  79. array( 'core/paragraph', array(
  80. 'placeholder' => 'Write your call to action here. Give it a large font size and a color background.',
  81. 'customFontSize' => '28',
  82. 'customTextColor' => '#ffffff',
  83. 'customBackgroundColor' => '#313131',
  84. ) ),
  85. array( 'core/button', array(
  86. 'customBackgroundColor' => '#CF2E2E',
  87. 'customTextColor' => '#ffffff',
  88. 'align' => 'center',
  89. ) ),
  90. );
  91. }
  92. add_action( 'init', 'bbp_add_portfolio_template' );
  93.  
  94. // Add REST API support for portfolio categories
  95. function add_portfolio_cat_to_api() {
  96. $mytax = get_taxonomy( 'portfolio_category' );
  97. $mytax->show_in_rest = true;
  98. }
  99. add_action( 'init', 'add_portfolio_cat_to_api', 30 );
  100.  
  101.  
  102. // Add REST API support for portfolio tags
  103. function add_portfolio_tag_to_api() {
  104. $mytax = get_taxonomy( 'portfolio_tag' );
  105. $mytax->show_in_rest = true;
  106. }
  107. add_action( 'init', 'add_portfolio_tag_to_api', 30 );
Add Comment
Please, Sign In to add comment