Advertisement
thierry-eamon

functions.php

Oct 19th, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.73 KB | None | 0 0
  1. <?php
  2.     register_taxonomy('featured',array (
  3.     0 => 'projects',
  4.     ),array(
  5.         'hierarchical' => false,
  6.         'label' => 'Featured',
  7.         'show_ui' => false,
  8.         'query_var' => true,
  9.         'rewrite' => array('slug' => ''),
  10.         'singular_label' => 'Featured post')
  11.               );
  12.  
  13.  
  14.     register_taxonomy('clients',array (
  15.     0 => 'projects',
  16.     ),array(
  17.         'hierarchical' => true,
  18.         'label' => 'Clients',
  19.         'show_ui' => true,
  20.         'query_var' => true,
  21.         'rewrite' => array( 'slug' => 'client', 'with_front' => true ),
  22.         'singular_label' => 'Client')
  23.               );
  24.  
  25.  
  26.     register_taxonomy('uitingen',array (
  27.     0 => 'projects',
  28.     ),array(
  29.         'hierarchical' => true,
  30.         'label' => 'Uitingen',
  31.         'show_ui' => true,
  32.         'query_var' => true,
  33.         'rewrite' => array( 'slug' => 'uiting', 'with_front' => true ),
  34.         'singular_label' => 'Uiting')
  35.               );
  36.  
  37.  
  38.  
  39.     register_post_type('projects', array(
  40.         'label' => 'Projects',
  41.         'description' => 'Hieronder vallen alle afgeronde projecten van TRIPP.',
  42.         'public' => true,
  43.         'show_ui' => true,
  44.         'show_in_menu' => true,
  45.         'capability_type' => 'post',
  46.         'hierarchical' => false,
  47.         'rewrite' => array( 'slug' => 'project', 'with_front' => true ),
  48.         'query_var' => true,
  49.         'has_archive' => true,
  50.        
  51.         'menu_position' => 3,
  52.         'menu_icon' => get_template_directory_uri().'/images/projects.png', // 16px16
  53.  
  54.         'supports' => array('title','editor','custom-fields','revisions','thumbnail','author',),
  55.         'labels' => array (
  56.             'name' => 'Projects',
  57.             'singular_name' => 'Project',
  58.             'menu_name' => 'Projects',
  59.             'add_new' => 'Add Project',
  60.             'add_new_item' => 'Add New Project',
  61.             'edit' => 'Edit',
  62.             'edit_item' => 'Edit Project',
  63.             'new_item' => 'New Project',
  64.             'view' => 'View Project',
  65.             'view_item' => 'View Project',
  66.             'search_items' => 'Search Projects',
  67.             'not_found' => 'No Projects Found',
  68.             'not_found_in_trash' => 'No Projects Found in Trash',
  69.             'parent' => 'Parent Project',
  70. ),) );
  71.  
  72.  
  73. function pagination($prev = '&laquo;', $next = '&raquo;') {
  74.     global $wp_query, $wp_rewrite;
  75.     $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
  76.     $pagination = array(
  77.         'base' => @add_query_arg('paged','%#%'),
  78.         'format' => '',
  79.         'total' => $wp_query->max_num_pages,
  80.         'current' => $current,
  81.         'prev_text' => __($prev),
  82.         'next_text' => __($next),
  83.         'type' => 'plain'
  84. );
  85.     if( $wp_rewrite->using_permalinks() )
  86.         $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );
  87.  
  88.     if( !empty($wp_query->query_vars['s']) )
  89.         $pagination['add_args'] = array( 's' => get_query_var( 's' ) );
  90.  
  91.     echo paginate_links( $pagination );
  92. };
  93.  
  94.  
  95.  
  96. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement