Advertisement
Guest User

code

a guest
Dec 8th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 20.64 KB | None | 0 0
  1. <?php
  2. // Add your custom functions here
  3.  
  4. // Queue parent style followed by child/customized style
  5. add_action( 'wp_enqueue_scripts', 'sparkling_enqueue_child_styles', 99);
  6.  
  7. function sparkling_enqueue_child_styles() {
  8.     wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
  9.     wp_dequeue_style('sparkling-style');
  10.     wp_enqueue_style( 'child-style',
  11.         get_stylesheet_directory_uri() . '/style.css',
  12.         array('parent-style')
  13.     );
  14. }
  15.  
  16. register_sidebar( array(
  17.     'name'          => __( 'International Start', 'sparkling' ),
  18.     'id'            => 'internationalstart',
  19.     'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  20.     'after_widget'  => '</aside>',
  21.     'before_title'  => '<h3 class="widget-title">',
  22.     'after_title'   => '</h3>',
  23. ) );
  24.  
  25. register_sidebar( array(
  26.     'name'          => __( 'Benelux Start', 'sparkling' ),
  27.     'id'            => 'beneluxstart',
  28.     'before_widget' => '<aside id="%1$s" class="widget %2$s">',
  29.     'after_widget'  => '</aside>',
  30.     'before_title'  => '<h3 class="widget-title">',
  31.     'after_title'   => '</h3>',
  32. ) );
  33.  
  34.  
  35.  
  36. ?>
  37. <?php
  38. function my_category_queries( $query ) {
  39. // only homepage and is the main query
  40. if ($query->is_home() && $query->is_main_query()){
  41. // display only posts in category with slug 'articles'
  42. $query->set('category_name', 'news');
  43. // avoid sticky posts
  44. $query->set('post__not_in', get_option( 'sticky_posts' ) );
  45. }
  46. }
  47. add_action( 'pre_get_posts', 'my_category_queries' );
  48. ?>
  49. <?php
  50.  
  51. add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
  52. function theme_enqueue_styles() {
  53.     wp_enqueue_style( 'sparkling-bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css' );
  54.     wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
  55.  
  56. }
  57.  
  58. if ( ! function_exists( 'sparkling_header_menu' ) ) :
  59. /**
  60.  * Header menu (should you choose to use one)
  61.  */
  62. function sparkling_header_menu() {
  63.   // display the WordPress Custom Menu if available
  64.   wp_nav_menu(array(
  65.     'menu'              => 'primary',
  66.     'theme_location'    => 'primary',
  67.     'depth'             => 6,
  68.     'container'         => 'div',
  69.     'container_class'   => 'collapse navbar-collapse navbar-ex1-collapse',
  70.     'menu_class'        => 'nav navbar-nav',
  71.     'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
  72.     'walker'            => new wp_bootstrap_navwalker()
  73.   ));
  74. } /* end header menu */
  75. endif;
  76.  
  77. update_option('upload_url_path', '/wp-content/uploads');
  78.  
  79. function only_admins_login_area( $redirect_to, $request, $user ) {
  80.     global $user;
  81.     if ( isset( $user->roles ) && is_array( $user->roles ) )
  82.     {
  83.         //check for admins
  84.         if ( in_array( 'administrator', $user->roles ) )
  85.         {
  86.             // Redirect to default admin area
  87.             return $redirect_to;
  88.         }
  89.     }
  90.  
  91.     return home_url();
  92. }
  93.  
  94. add_filter( 'login_redirect', 'only_admins_login_area', 10, 3 );
  95.  
  96. function exclude_widget_categories($args){
  97. $exclude = "122"; // The IDs of the excluding categories
  98. $args["exclude"] = $exclude;
  99. return $args;
  100. }
  101. add_filter("widget_categories_args","exclude_widget_categories");
  102. ?>
  103.  
  104. <?php
  105. function register_my_menus() {
  106.   register_nav_menus(
  107.     array(
  108.       'benelux' => __( 'Benelux' ),
  109.       'International' => __( 'International' )
  110.     )
  111.   );
  112. }
  113. add_action( 'init', 'register_my_menus' );
  114. ?>
  115.  
  116. <?php
  117. add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy');
  118. function tsm_filter_post_type_by_taxonomy() {
  119.     global $typenow;
  120.     $post_type = 'post'; // change to your post type  
  121.     $taxonomy  = 'location'; // change to your taxonomy
  122.     if ($typenow == $post_type) {
  123.         $selected      = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
  124.         $info_taxonomy = get_taxonomy($taxonomy);
  125.         wp_dropdown_categories(array(
  126.             'show_option_all' => __("All Locations"),
  127.             'taxonomy'        => $taxonomy,
  128.             'name'            => $taxonomy,
  129.             'orderby'         => 'name',
  130.             'selected'        => $selected,
  131.             'show_count'      => false,
  132.             'hide_empty'      => true,
  133.         ));
  134.     };
  135. }
  136.  
  137. add_filter('parse_query', 'tsm_convert_id_to_term_in_query');
  138. function tsm_convert_id_to_term_in_query($query) {
  139.     global $pagenow;
  140.     $post_type = 'post'; // change to your post type
  141.     $taxonomy  = 'location'; // change to your taxonomy
  142.     $q_vars    = &$query->query_vars;
  143.     if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
  144.         $term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
  145.         $q_vars[$taxonomy] = $term->slug;
  146.     }
  147. }
  148.  
  149.  
  150. add_action('restrict_manage_posts', 'page_filter_post_type_by_taxonomy');
  151. function page_filter_post_type_by_taxonomy() {
  152.     global $typenow;
  153.     $post_type = 'page'; // change to your post type
  154.     $taxonomy  = 'location'; // change to your taxonomy
  155.     if ($typenow == $post_type) {
  156.         $selected      = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : '';
  157.         $info_taxonomy = get_taxonomy($taxonomy);
  158.         wp_dropdown_categories(array(
  159.             'show_option_all' => __("All Locations"),
  160.             'taxonomy'        => $taxonomy,
  161.             'name'            => $taxonomy,
  162.             'orderby'         => 'name',
  163.             'selected'        => $selected,
  164.             'show_count'      => false,
  165.             'hide_empty'      => true,
  166.         ));
  167.     };
  168. }
  169.  
  170. add_filter('parse_query', 'page_convert_id_to_term_in_query');
  171. function page_convert_id_to_term_in_query($query) {
  172.     global $pagenow;
  173.     $post_type = 'page'; // change to your post type
  174.     $taxonomy  = 'location'; // change to your taxonomy
  175.     $q_vars    = &$query->query_vars;
  176.     if ( $pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0 ) {
  177.         $term = get_term_by('id', $q_vars[$taxonomy], $taxonomy);
  178.         $q_vars[$taxonomy] = $term->slug;
  179.     }
  180. }
  181. ?>
  182.  
  183. <?php
  184. add_filter( 'manage_edit-post_sortable_columns', 'my_sortable_post_column' );
  185. function my_sortable_post_column( $columns ) {
  186.     $columns['author'] = 'author';
  187.     $columns['categories'] = 'categories';
  188.     $columns['column-taxonomy'] = 'column-taxonomy';
  189.     $columns['column-meta'] = 'column-meta';
  190.  
  191.     //To make a column 'un-sortable' remove it from the array
  192.     //unset($columns['date']);
  193.  
  194.     return $columns;
  195. }
  196.  
  197. add_filter( 'manage_edit-page_sortable_columns', 'page_post_column' );
  198. function page_post_column( $columns ) {
  199.     $columns['author'] = 'author';
  200.     $columns['categories'] = 'categories';
  201.     $columns['column-taxonomy'] = 'column-taxonomy';
  202.  
  203.     //To make a column 'un-sortable' remove it from the array
  204.     //unset($columns['date']);
  205.  
  206.     return $columns;
  207. }
  208.  
  209. add_filter( 'manage_edit-sm-location_sortable_columns', 'locations_post_column' );
  210. function locations_post_column( $columns ) {
  211.     $columns['column-taxonomy'] = 'column-taxonomy';
  212.     $columns['column-meta'] = 'column-meta';
  213.     $columns['column-meta-1'] = 'column-meta-1';
  214.     $columns['column-meta-2'] = 'column-meta-2';
  215.     $columns['column-meta-3'] = 'column-meta-3';
  216.  
  217.     //To make a column 'un-sortable' remove it from the array
  218.     //unset($columns['date']);
  219.  
  220.     return $columns;
  221. }
  222.  
  223.  
  224. add_filter( 'ngg_manage_images_columns', 'ngg_thumbnail_column' );
  225. function ngg_thumbnail_column( $columns ) {
  226.     $columns['thumbnail'] = 'thumbnail';
  227.  
  228.     //To make a column 'un-sortable' remove it from the array
  229.     //unset($columns['date']);
  230.  
  231. return $columns;
  232. }
  233.  
  234. ?>
  235.  
  236. <?php
  237. function benelux_featured_slider() {
  238.          {
  239.             echo '<div class="flexslider">';
  240.             echo '<ul class="slides">';
  241.  
  242.             $count = of_get_option( 'sparkling_slide_number' );
  243.             $slidecat = of_get_option( 'sparkling_slide_categories' );
  244.  
  245.             $query = new WP_Query( array(
  246.                 'cat' => '230',
  247.                 'posts_per_page' => $count,
  248.                 'meta_query' => array(
  249.                     array(
  250.                      'key' => '_thumbnail_id',
  251.                      'compare' => 'EXISTS'
  252.                     ),
  253.                 ),
  254.             ) );
  255.             if ( $query->have_posts() ) :
  256.                 while ( $query->have_posts() ) : $query->the_post();
  257.  
  258.                     if ( of_get_option( 'sparkling_slider_link_checkbox', 1 ) == 1 ) {
  259.                         echo '<li><a href="' . get_permalink() . '">';
  260.                     } else {
  261.                         echo '<li>';
  262.                     }
  263.                    
  264.                     if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
  265.                         if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
  266.                             $feat_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
  267.                             $args = array(
  268.                                 'resize' => '1920,550',
  269.                             );
  270.                             $photon_url = jetpack_photon_url( $feat_image_url[0], $args );
  271.                             echo '<img src="' . $photon_url . '">';
  272.                         } else {
  273.                               echo get_the_post_thumbnail( get_the_ID(), 'activello-slider' );
  274.                         }
  275.                     endif;
  276.  
  277.                     echo '<div class="flex-caption">';
  278.                     if ( get_the_title() != '' ) { echo '<h2 class="entry-title">' . get_the_title() . '</h2>';
  279.                     }
  280.                     if ( get_the_excerpt() != '' ) { echo '<div class="excerpt">' . get_the_excerpt() . '</div>';
  281.                     }
  282.                     echo '</div>';
  283.                     echo '</a></li>';
  284.               endwhile;
  285.                 endif;
  286.             wp_reset_postdata();
  287.             echo '</ul>';
  288.             echo ' </div>';
  289.         }// End if().
  290.     }
  291.     ?>
  292.  
  293. <?php
  294. function international_featured_slider() {
  295.          {
  296.             echo '<div class="flexslider">';
  297.             echo '<ul class="slides">';
  298.  
  299.             $count = of_get_option( 'sparkling_slide_number' );
  300.             $slidecat = of_get_option( 'sparkling_slide_categories' );
  301.  
  302.             $query = new WP_Query( array(
  303.                 'cat' => '231',
  304.                 'posts_per_page' => $count,
  305.                 'meta_query' => array(
  306.                     array(
  307.                      'key' => '_thumbnail_id',
  308.                      'compare' => 'EXISTS'
  309.                     ),
  310.                 ),
  311.             ) );
  312.             if ( $query->have_posts() ) :
  313.                 while ( $query->have_posts() ) : $query->the_post();
  314.  
  315.                     if ( of_get_option( 'sparkling_slider_link_checkbox', 1 ) == 1 ) {
  316.                         echo '<li><a href="' . get_permalink() . '">';
  317.                     } else {
  318.                         echo '<li>';
  319.                     }
  320.                    
  321.                     if ( (function_exists( 'has_post_thumbnail' )) && ( has_post_thumbnail() ) ) :
  322.                         if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'photon' ) ) {
  323.                             $feat_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
  324.                             $args = array(
  325.                                 'resize' => '1920,550',
  326.                             );
  327.                             $photon_url = jetpack_photon_url( $feat_image_url[0], $args );
  328.                             echo '<img src="' . $photon_url . '">';
  329.                         } else {
  330.                               echo get_the_post_thumbnail( get_the_ID(), 'activello-slider' );
  331.                         }
  332.                     endif;
  333.  
  334.                     echo '<div class="flex-caption">';
  335.                     if ( get_the_title() != '' ) { echo '<h2 class="entry-title">' . get_the_title() . '</h2>';
  336.                     }
  337.                     if ( get_the_excerpt() != '' ) { echo '<div class="excerpt">' . get_the_excerpt() . '</div>';
  338.                     }
  339.                     echo '</div>';
  340.                     echo '</a></li>';
  341.               endwhile;
  342.                 endif;
  343.             wp_reset_postdata();
  344.             echo '</ul>';
  345.             echo ' </div>';
  346.         }// End if().
  347.     }
  348.  
  349.     ?>    
  350.   <?php
  351.  
  352. /**
  353.  * Enqueue scripts and styles.
  354.  */
  355. function international_scripts() {
  356.  
  357.     wp_dequeue_script( 'flexslider-js' );
  358.     wp_dequeue_script( 'flexslider-customization' );
  359.  
  360.     wp_enqueue_script( 'flexslider-js', get_template_directory_uri() . '/assets/js/vendor/flexslider.min.js', array( 'jquery' ), '20140222', true );
  361.     // Flexslider customization
  362.     wp_enqueue_script( 'flexslider-customization', get_template_directory_uri() . '/assets/js/flexslider-custom.min.js', array( 'jquery', 'flexslider-js' ), '20140716', true );
  363.  
  364.     // Add slider CSS for pages
  365.     wp_enqueue_style( 'flexslider-css', get_template_directory_uri().'/assets/css/flexslider.css' );
  366.  
  367. }
  368. add_action( 'wp_enqueue_scripts', 'international_scripts' );
  369.  
  370. function benelux_scripts() {
  371.  
  372.     wp_dequeue_script( 'flexslider-js' );
  373.     wp_dequeue_script( 'flexslider-customization' );
  374.  
  375.     wp_enqueue_script( 'flexslider-js', get_template_directory_uri() . '/assets/js/vendor/flexslider.min.js', array( 'jquery' ), '20140222', true );
  376.     // Flexslider customization
  377.     wp_enqueue_script( 'flexslider-customization', get_template_directory_uri() . '/assets/js/flexslider-custom.min.js', array( 'jquery', 'flexslider-js' ), '20140716', true );
  378.  
  379.     // Add slider CSS for pages
  380.     wp_enqueue_style( 'flexslider-css', get_template_directory_uri().'/assets/css/flexslider.css' );
  381.  
  382. }
  383. add_action( 'wp_enqueue_scripts', 'benelux_scripts' );
  384.  
  385.  
  386. add_action('template_redirect', 'bwp_template_redirect');
  387. function bwp_template_redirect()
  388. {
  389. if (is_author())
  390. {
  391. wp_redirect( home_url() ); exit;
  392. }
  393. }
  394.  
  395. function author_archive_redirect() {
  396.    if( is_author() ) {
  397.        wp_redirect( home_url(), 301 );
  398.        exit;
  399.    }
  400. }
  401. add_action( 'template_redirect', 'author_archive_redirect' );
  402.  
  403. /*remove wordpress version number from front-end pages*/
  404. function remove_version_from_mysite() {
  405.   return '';
  406. }
  407. add_filter('the_generator','remove_version_from_mysite');
  408. add_filter('generator','remove_version_from_mysite');
  409.  
  410. /**
  411.  * Add custom taxonomies
  412.  *
  413.  * Additional custom taxonomies can be defined here
  414.  * http://codex.wordpress.org/Function_Reference/register_taxonomy
  415.  */
  416. function add_custom_taxonomies() {
  417.   // Add new "Location" taxonomy to Posts
  418.   register_taxonomy('location',array('post','page','attachment'), array(
  419.     // Hierarchical taxonomy (like categories)
  420.     'hierarchical' => true,
  421.     // This array of options controls the labels displayed in the WordPress Admin UI
  422.     'labels' => array(
  423.       'name' => _x( 'Location', 'taxonomy general name' ),
  424.       'singular_name' => _x( 'Location', 'taxonomy singular name' ),
  425.       'search_items' =>  __( 'Search Locations' ),
  426.       'all_items' => __( 'All Locations' ),
  427.       'parent_item' => __( 'Parent Location' ),
  428.       'parent_item_colon' => __( 'Parent Location:' ),
  429.       'edit_item' => __( 'Edit Location' ),
  430.       'update_item' => __( 'Update Location' ),
  431.       'add_new_item' => __( 'Add New Location' ),
  432.       'new_item_name' => __( 'New Location Name' ),
  433.       'menu_name' => __( 'Location' ),
  434.     ),
  435.      // Control the slugs used for this taxonomy
  436.         'rewrite' => array(
  437.       'with_front' => true,
  438.       'ep_mask'=> EP_ALL,
  439.     ),
  440.   ));
  441. }
  442. add_action( 'init', 'add_custom_taxonomies', 0 );
  443.  
  444. /*add_rewrite_tag('%location%', '^([^&/]+)', 'location=');
  445. add_rewrite_rule('^([^/]*)/([^/]*)/?','index.php?location=$matches[1]&name=$matches[2]','top');
  446. */
  447.  
  448. // add region category to main queries
  449. add_action('pre_get_posts', 'tg_set_region');
  450. function tg_set_region( $query ) {
  451.     //--------debug-----------
  452. //if ( !is_admin() && $query->is_main_query())
  453.  //  print_r( $query );
  454. //-----------------------
  455.   if ( get_option('page_on_front') == $query->get('page_id')) return;
  456.   if ( !is_admin() && $query->is_main_query()) {
  457.     global $region;
  458.     $explode = explode('/', $_SERVER['REQUEST_URI']);
  459.     $cat = $query->get('category_name');
  460.     $region = $explode[1];  // $region = 'benelux'; //$explode[1];
  461.     if ( '' != $cat ) $cat .= '+' . $region;
  462.         else $cat = $region;
  463.     $query->set('category_name', $cat);
  464.   }
  465. }
  466. // go to region home page if a home page request from same site
  467. // region determined from referrer URL
  468. //add_action('init', 'tg_home_by_region');
  469. function tg_home_by_region( $query ) {
  470.   if ( array_key_exists('HTTP_REFERER', $_SERVER ) && 0 === strpos( $_SERVER['HTTP_REFERER'], site_url('/'))) {
  471.     $explode = explode('/', $_SERVER['HTTP_REFERER']);
  472.     $region = $explode[3];
  473.     if ( "/$region/" != $_SERVER['REQUEST_URI'] && '/' == $_SERVER['REQUEST_URI']) {
  474.       wp_redirect( site_url("/$region/"));
  475.       exit;
  476.     }
  477.   }
  478. }
  479. // alter category and tag links to be compatible with global $region category
  480. //add_filter('term_link', 'tg_alter_term_links', 999, 3 );
  481. function tg_alter_term_links( $termlink, $term, $taxonomy ) {
  482.    global $region;
  483.    if ('category' == $taxonomy ) {
  484.       $termlink = site_url('/') . $region . '?category_name=' . $term->slug;
  485.    }
  486.    if ('post_tag' == $taxonomy ) {
  487.       $termlink = site_url('/') . $region . '?tag=' . $term->slug;
  488.    }
  489.    return $termlink;
  490. }
  491.  
  492. /**
  493.  * Outputs prev/next nav links for custom query pages
  494.  *
  495.  * @param array, $args, the same $args used for the page's main WP_Query
  496.  *          The args array must include an 'offset' argument, relying on 'paged' will not work.
  497.  *      string, $next, text for next page link (optional) default "Older Posts"
  498.  *      string, $prev, text for previous page link (optional) default "Newer Posts"
  499.  * @return none, outputs prev/next nav links with region_page URL parm inside a div with
  500.  *      class 'search_page_nav', anchor links have class 'search_page_next' and 'search_page_prev'
  501.  * @globals $_GET['region_page'], used to determine current page number. Page 1 assumed
  502.  *      if 'region_page' is not set.
  503.  */
  504. function tg_custom_query_nav( $args, $next = 'Older Posts', $prev = 'Newer Posts' ) {
  505.     // determine pagination parms
  506.     $s_page = isset( $_GET['region_page']) ? sanitize_text_field( $_GET['region_page']) : 1;
  507.     $pppage = isset( $args['posts_per_page']) ? $args['posts_per_page'] : get_option('posts_per_page');
  508.     if ( -1 == $pppage ) return;
  509.     $prev_off = ( $s_page - 2 ) * $pppage;
  510.     $next_off = $s_page * $pppage;
  511.  
  512.     // check for more posts
  513.     $args['no_found_posts'] = true;     // just get a count
  514.     $args['ignore_sticky_posts'] = true;
  515.     $args['offset'] = $next_off;
  516.     $query = new WP_Query( $args );     // get next page post count
  517.     $ct_next = $query->post_count;
  518.     $args['offset'] = $prev_off;
  519.     $query = new WP_Query( $args );     // get prev page post count
  520.     $ct_prev = 1 < $s_page ? $query->post_count : 0;
  521.  
  522.     // output links
  523.     echo "\n<div class=\"paging-navigation\"><div class=\"nav-links\">";
  524.     $link = remove_query_arg('region_page');
  525.     $next .= '<i class="fa fa-chevron-right" aria-hidden="true"></i>';
  526.     $nxt_link = esc_url( add_query_arg('region_page', $s_page+1, $link ));
  527.     if ( $ct_next ) echo "\n<a class=\"nav-next\" href=\"$nxt_link\">$next</a>";
  528.     $prev = '<i class="fa fa-chevron-left" aria-hidden="true"></i>'. $prev;
  529.     $prv_link = esc_url( add_query_arg('region_page', $s_page-1, $link ));
  530.     if ( $ct_prev ) echo "\n<a class=\"nav-previous\" href=\"$prv_link\">$prev</a>\n";
  531.     echo "</div></div>\n";
  532. }
  533.  
  534. // Insert region into post links
  535. add_filter('post_link', 'tg_add_region', 999, 3 );
  536. function tg_add_region( $link, $post, $leavename) {
  537.    global $region;
  538.    $link = str_replace('.com/', ".com/$region/", $link );
  539.    return $link;
  540. }
  541. // Insert region into post links
  542. add_filter('post_link', 'tg_add_region', 999, 3 );
  543. function tg_add_region( $link, $post, $leavename) {
  544.    global $region;
  545.    $cats = wp_get_post_categories( $post->ID, array('fields'=>'ids',));
  546.    if ( in_array( 123, $cats )) $region = 'benelux';
  547.    if ( in_array( 124, $cats )) $region = 'international';
  548.    if ( null == $region ) $region = 'international';
  549.    $link = str_replace('.com/', ".com/$region/", $link );
  550.    return $link;
  551. }
  552.  
  553. // Add region category to main queries
  554. add_action('pre_get_posts', 'tg_set_region');
  555. function tg_set_region( $query ) {
  556.   if ( get_option('page_on_front') == $query->get('page_id')) return;
  557.   if ( !is_admin() && $query->is_main_query()) {
  558.     global $region;
  559.     $explode = explode('/', $_SERVER['REQUEST_URI']);
  560.     $cat = $query->get('category_name');
  561.     $region = $explode[1];
  562.     if ( ! in_array( $region, array('benelux','international',))) $region = 'international';
  563.     if ( '' != $cat ) $cat .= '+' . $region;
  564.         else $cat = $region;
  565.     $query->set('category_name', $cat);
  566.   }
  567. }
  568.  
  569.  
  570.  
  571.  
  572. @ini_set( 'upload_max_size' , '64M' );
  573. @ini_set( 'post_max_size', '64M');
  574. @ini_set( 'max_execution_time', '300' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement