Guest User

functions.php

a guest
Nov 15th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.37 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.         global $themename, $shortname, $default_colorscheme;
  6.         $themename = "LightBright";
  7.         $shortname = "lightbright";
  8.         $default_colorscheme = "Default";
  9.  
  10.         $template_dir = get_template_directory();
  11.  
  12.         require_once($template_dir . '/epanel/custom_functions.php');
  13.  
  14.         require_once($template_dir . '/includes/functions/comments.php');
  15.  
  16.         require_once($template_dir . '/includes/functions/sidebars.php');
  17.  
  18.         load_theme_textdomain('LightBright',$template_dir.'/lang');
  19.  
  20.         require_once($template_dir . '/epanel/core_functions.php');
  21.  
  22.         require_once($template_dir . '/epanel/post_thumbnails_lightbright.php');
  23.  
  24.         include($template_dir . '/includes/widgets.php');
  25.  
  26.         require_once($template_dir . '/includes/functions/custom_posts.php');
  27.  
  28.         add_action( 'pre_get_posts', 'et_posts_query' );
  29.     }
  30. }
  31.  
  32. /**
  33.  * Filters the main query
  34.  */
  35. function et_posts_query( $query = false ) {
  36.     /* Don't proceed if it's not homepage or the main query */
  37.     if ( is_admin() || ! is_a( $query, 'WP_Query' ) || ! $query->is_main_query() ) return;
  38.  
  39.     /* Set the amount of posts per page on homepage */
  40.     if ( is_home() ) $query->set( 'posts_per_page', (int) et_get_option( 'lightbright_homepage_posts', '6' ) );
  41.  
  42.     if ( ! is_singular() && ! is_post_type_archive() ) $query->set( 'post_type', array( 'note', 'photo', 'quote', 'video', 'customlink', 'audio', 'post' ) );
  43.  
  44.     if ( is_post_type_archive( 'note' ) ) $query->set( 'post_type', array( 'note', 'post' ) );
  45. }
  46.  
  47. add_action('wp_head','et_portfoliopt_additional_styles',100);
  48. function et_portfoliopt_additional_styles(){ ?>
  49.     <style type="text/css">
  50.         #et_pt_portfolio_gallery { margin-left: -15px; }
  51.         .et_pt_portfolio_item { margin-left: 21px; width: 192px; }
  52.         .et_portfolio_small { margin-left: -40px !important; }
  53.         .et_portfolio_small .et_pt_portfolio_item { margin-left: 32px !important; }
  54.         .et_portfolio_large { margin-left: -10px !important; }
  55.         .et_portfolio_large .et_pt_portfolio_item { margin-left: 15px !important; }
  56.  
  57.         .et_portfolio_more_icon, .et_portfolio_zoom_icon { top: 49px; }
  58.         .et_portfolio_more_icon { left: 54px; }
  59.         .et_portfolio_zoom_icon { left: 95px; }
  60.         .et_portfolio_small .et_pt_portfolio_item { width: 102px; }
  61.         .et_portfolio_small .et_portfolio_more_icon { left: 11px; }
  62.         .et_portfolio_small .et_portfolio_zoom_icon { left: 49px; }
  63.         .et_portfolio_large .et_pt_portfolio_item { width: 312px; }
  64.         .et_portfolio_large .et_portfolio_more_icon, .et_portfolio_large .et_portfolio_zoom_icon { top: 85px; }
  65.         .et_portfolio_large .et_portfolio_more_icon { left: 119px; }
  66.         .et_portfolio_large .et_portfolio_zoom_icon { left: 158px; }
  67.     </style>
  68. <?php }
  69.  
  70. function register_main_menus() {
  71.     register_nav_menus( array(
  72.         'primary-menu' => 'Primary Navigation', 'LightBright'
  73.     ) );
  74. };
  75. if (function_exists('register_nav_menus')) add_action( 'init', 'register_main_menus' );
  76.  
  77. if ( ! function_exists( 'et_list_pings' ) ){
  78.     function et_list_pings($comment, $args, $depth) {
  79.         $GLOBALS['comment'] = $comment; ?>
  80.         <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> - <?php comment_excerpt(); ?>
  81.     <?php }
  82. }
  83.  
  84. add_filter( 'et_fullpath', 'et_change_fullpath' );
  85. function et_change_fullpath( $thumb ){
  86.     global $post;
  87.     if ( is_page() ) return $thumb;
  88.     if ( get_post_meta( $post->ID, 'thumb', true ) ) $thumb = get_post_meta( $post->ID, 'thumb', true );
  89.     return $thumb;
  90. }
  91.  
  92. function et_epanel_custom_colors_css(){
  93.     global $shortname; ?>
  94.  
  95.     <style type="text/css">
  96.         #container { color: #<?php echo esc_html(get_option($shortname.'_color_mainfont')); ?>; }
  97.         a { color: #<?php echo esc_html(get_option($shortname.'_color_mainlink')); ?>; }
  98.         ul.nav li a { color: #<?php echo esc_html(get_option($shortname.'_color_pagelink')); ?>; }
  99.         ul.nav li a:hover { color: #<?php echo esc_html(get_option($shortname.'_color_pagelink_active')); ?>; }
  100.         h1, h2, h3, h4, h5, h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: #<?php echo esc_html(get_option($shortname.'_color_headings')); ?>; }
  101.  
  102.         #sidebar a { color:#<?php echo esc_html(get_option($shortname.'_color_sidebar_links')); ?>; }
  103.         div#footer { color:#<?php echo esc_html(get_option($shortname.'_footer_text')); ?> }
  104.         #footer a, #footer a:visited { color:#<?php echo esc_html(get_option($shortname.'_color_footerlinks')); ?> }
  105.     </style>
  106.  
  107. <?php }
Advertisement
Add Comment
Please, Sign In to add comment