Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. function berman_setup_custom_acf_page_types( $berman ) {
  2.  
  3.     $page_types = array(
  4.         'page_for_product_categories'     => __('Page For Product Categories', 'Global Pages post-states', 'berman'),
  5.         'page_for_404'                    => __('Page For 404', 'Global Pages post-states', 'berman'),
  6.     );
  7.  
  8.     new Layer\Custom_ACF_Page_Type($page_types);
  9.  
  10.     $suffix_page_id = '_id';
  11.     $suffix_permalink = '_permalink';
  12.     foreach ( $page_types as $page_type => $page_type_label ) {
  13.         $page_id_variable = ${$page_type . $suffix_page_id};
  14.         $page_id = get_field($page_type, 'options');
  15.         $berman->{$page_id_variable} = (int)$page_id;
  16.         $berman->${$page_type . $suffix_permalink} = get_the_permalink( $page_id );
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement