reportaprod /blog/wp-content/themes/spectrum/functions.php

Language PHP Lines 145
MD5 Hash 7bebe898f2b918482fecec809d1f528e Estimated Cost $2,156 (why?)
Repository https://bitbucket.org/sergiohzlz/reportaprod View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
/**
 * @package WordPress
 * @subpackage Spectrum
 */

// Enqueue the Spectrum scripts
function spectrum_script_init() {
	wp_enqueue_script( 'jquery' );
	wp_enqueue_script( 'spectrum-min', get_bloginfo( 'template_directory' ) . '/js/spectrum-min.js', array( 'jquery' ) );
}
add_action( 'init', 'spectrum_script_init' );

// Get the Spectrum theme options
require_once( get_template_directory() . '/theme-options.php' );

$themecolors = array(
	'bg' => 'ffffff',
	'border' => 'dddddd',
	'text' => '444444',
	'link' => 'AC6C13',
	'url' => 'AC6C13'
);

$content_width = 540;

function spectrum_widgets_init() {
	register_sidebar( array(
		'name' => __( 'Primary Widget Area', 'spectrum' ),
		'id' => 'primary-widget-area',
		'description' => __( 'The primary widget area', 'spectrum' ),
		'before_widget' => '<div id="%1$s" class="widget %2$s sidebar-box">',
		'after_widget' => '</div>',
		'before_title' => '<div class="sidebar-title"><h4>',
		'after_title' => '</h4></div>'
	));
}

add_action( 'widgets_init', 'spectrum_widgets_init' );

add_theme_support( 'automatic-feed-links' );

register_nav_menus( array(
	'primary' => __( 'Primary Navigation' ),
) );

function spectrum_page_menu() { // fallback for primary navigation ?>
	<ul>
		<?php wp_list_pages( 'title_li=&depth=1' ); ?>
	</ul>

<?php }

add_custom_background();

// Allow custom colors to clear the background image
function spectrum_custom_background_color() {
	if ( get_background_image() == '' && get_background_color() != '' ) { ?>
		<style type="text/css">
		body {
			background-image: none;
		}
		</style>
	<?php }
}
add_action( 'wp_head', 'spectrum_custom_background_color' );

define( 'HEADER_IMAGE', '' );
define( 'HEADER_IMAGE_WIDTH', 938 );
define( 'HEADER_IMAGE_HEIGHT', 150 );
define( 'HEADER_TEXTCOLOR', '' );
define( 'NO_HEADER_TEXT', true );

function admin_header_style() {
    ?><style type="text/css">
        #headimg {
            width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
            height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
        }
    </style><?php
}

add_custom_image_header( '', 'admin_header_style' );


// Tag Cloud

function spectrum_tag_cloud( $tags ) {
	$tags = preg_replace_callback( "|(class='tag-link-[0-9]+)('.*?)(style='font-size: )([0-9]+)(px;')|",
		create_function(
			'$match',
			'$low=1; $high=10; $sz=($match[4])/(2); return "{$match[1]} tagSize-{$sz}{$match[2]}";'
		),
		$tags );
	return $tags;
}

add_action( 'wp_tag_cloud', 'spectrum_tag_cloud' );

function spectrum_date() {
	$date_format = get_option( 'date_format' );
	if ( 'd/m/Y' == $date_format ) : ?>
		<span class="month"><?php the_time( 'd' ); ?></span>
		<span class="day"><?php the_time( 'm' ); ?></span>
		<span class="year"><?php the_time( 'y' ); ?></span>
	<?php elseif ( 'm/d/Y' == $date_format ) : ?>
		<span class="month"><?php the_time( 'm' ); ?></span>
		<span class="day"><?php the_time( 'd' ); ?></span>
		<span class="year"><?php the_time( 'y' ); ?></span>
	<?php elseif ( 'Y/m/d' == $date_format ) : ?>
		<span class="year"><?php the_time( 'y' ); ?></span>
		<span class="month"><?php the_time( 'm' ); ?></span>
		<span class="day"><?php the_time( 'd' ); ?></span>
	<?php else: // all other date formats get one big span ?>
		<span><?php the_date(); ?></span>
	<?php endif;
}

function spectrum_comments( $comment, $args, $depth ) {
	$GLOBALS[ 'comment' ] = $comment; ?>

	<li <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ); ?> id="comment-<?php comment_ID(); ?>">
		<div class="avatar-holder">
			<?php if ( $args[ 'avatar_size' ] != 0 ) echo get_avatar( $comment, $args[ 'avatar_size' ] ); ?>
		</div>
		<div <?php comment_class(); ?> id="div-comment-<?php comment_ID(); ?>">
			<div class="comment-author-and-date">
				<div class="comment-author">
					<?php printf( __( '<strong>%s</strong> <em>said:</em>' ), get_comment_author_link() ); ?>
				</div>
				<div class="commentDate">
					<a href="<?php comments_link(); ?> "><?php printf( __( '%1$s at %2$s' ), get_comment_date(),  get_comment_time() ); ?></a>
				</div>
			</div>
			<div class="commentText">
				<?php comment_text(); ?>
				<?php if ( $comment->comment_approved == '0' ) : ?>
				<p class="waiting4Mod"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
				<?php endif; ?>
				<p class="edit-comment"><?php edit_comment_link( __( '(Edit)' ),'','' ); ?></p>
				<p class="reply-link"><?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'reply_text' => '', 'max_depth' => $args[ 'max_depth' ] ) ) ); ?></p>
			</div>
		</div>

<?php } ?>
Back to Top