Advertisement
chrishajer

Reworked pastie 2755267

Oct 25th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.57 KB | None | 0 0
  1. <?php
  2. add_action( 'after_setup_theme', 'et_setup_theme' );
  3. if ( ! function_exists( 'et_setup_theme' ) ){
  4.     function et_setup_theme(){
  5.         require_once(TEMPLATEPATH . '/epanel/custom_functions.php');
  6.         require_once(TEMPLATEPATH . '/includes/functions/comments.php');
  7.         require_once(TEMPLATEPATH . '/includes/functions/sidebars.php');
  8.         load_theme_textdomain('Glow',get_template_directory().'/lang');
  9.         require_once(TEMPLATEPATH . '/epanel/options_glow.php');
  10.         require_once(TEMPLATEPATH . '/epanel/core_functions.php');
  11.         require_once(TEMPLATEPATH . '/epanel/post_thumbnails_glow.php');
  12.         include(TEMPLATEPATH . '/includes/widgets.php');
  13.     }
  14. }
  15.  
  16. add_action('wp_head','et_portfoliopt_additional_styles',100);
  17. function et_portfoliopt_additional_styles(){ ?>
  18.     <style type="text/css">
  19.         #et_pt_portfolio_gallery { margin-left: -15px; }
  20.         .et_pt_portfolio_item { margin-left: 15px; }
  21.         .et_portfolio_small { margin-left: -40px !important; }
  22.         .et_portfolio_small .et_pt_portfolio_item { margin-left: 31px !important; }
  23.         .et_portfolio_large { margin-left: -27px !important; }
  24.         .et_portfolio_large .et_pt_portfolio_item { margin-left: 9px !important; }
  25.     </style>
  26. <?php }
  27.  
  28. function register_main_menus() {
  29.     register_nav_menus(
  30.         array(
  31.             'primary-menu' => __( 'Primary Menu' ),
  32.             'secondary-menu' => __( 'Secondary Menu' )
  33.         )
  34.     );
  35. };
  36.  
  37. if (function_exists('register_nav_menus')) add_action( 'init', 'register_main_menus' );
  38.  
  39. if ( ! function_exists( 'et_list_pings' ) ){
  40.     function et_list_pings($comment, $args, $depth) {
  41.         $GLOBALS['comment'] = $comment; ?>
  42.         <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> - <?php comment_excerpt(); ?>
  43.     <?php }
  44. }
  45.  
  46. /* Display Posts as Choices */
  47. add_action('gform_pre_render', 'populate_post_type');
  48. function populate_post_type($form){
  49.  
  50.     $dropdown_field = 2; // update to the ID of your drop down field
  51.     $post_type = 'review'; // update
  52.     $choices = ounce_posts_as_choices($post_type);
  53.  
  54.     foreach($form['fields'] as &$field){
  55.         if($field['id'] == $dropdown_field)
  56.             $field['choices'] = $choices;
  57.     }
  58.     return $form;
  59. }
  60.  
  61. function ounce_posts_as_choices($post_type = 'post', $first_choice = '') {
  62.     $posts = get_posts("post_type=$post_type");
  63.     $choices = array();
  64.     $i = 0;
  65.  
  66.     if($first_choice){
  67.         $choices[$i]['text'] = $first_choice;
  68.         $choices[$i]['value'] = '';
  69.         $i++;
  70.     }
  71.  
  72.     foreach($posts as $post) {
  73.         $choices[$i]['text'] = $post->post_title;
  74.         $choices[$i]['value'] = $post->ID;
  75.         $i++;
  76.     }
  77.  
  78.     return $choices;
  79. }
  80.  
  81.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement