HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/HBergman/dezaakpartners.nl/wwwroot/wp-content/themes/pinzolo/functions.php
<?php


///////////////////////////////////////////////////////
// Header stuffs
wp_enqueue_script('jquery');
wp_enqueue_script('superfish', get_template_directory_uri() . '/js/superfish.js');
wp_enqueue_script('formalize', get_template_directory_uri() . '/js/jquery.formalize.min.js');
wp_enqueue_script('tinynav', 	 get_template_directory_uri() . '/js/tinynav.js');
wp_enqueue_script('pinzolo', 	 get_template_directory_uri() . '/js/pinzolo.js');
wp_enqueue_style('opensans', 	 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,300,600,700');

if ( is_singular() ) wp_enqueue_script( 'comment-reply' );

// add ie conditional html5 shim to header
function add_ie_html5_shim () {
	global $is_IE;
	if ($is_IE)
   	echo '<!--[if lt IE 9]>';
    	echo '<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>';
    	echo '<![endif]-->';
}
add_action('wp_head', 'add_ie_html5_shim');


///////////////////////////////////////////////////////
function pinzolo_search_form( $form ) {
		 
	if(!empty($s)) $svalue =  esc_attr_e($s, 1);
	else $svalue = 'search';
	
	$home = esc_url( home_url( '/' ) );

    $form = '<form action="'. $home .'" method="get">
				<input id="Searchform" type="text" class="textfield wpcf7-text" name="s" size="24" value="' . $svalue . '" />					
			</form>';

    return $form;
}
add_filter( 'get_search_form', 'pinzolo_search_form' );


///////////////////////////////////////////////////////
// Registers a dynamic sidebar.
register_sidebar(array('name'=>'Page Sidebar',
 	'before_widget' => '<div class="sidebar_widget">',
	'after_widget' => '</div>',
	'before_title' => '<h3>',
	'after_title' => '</h3>',
));


///////////////////////////////////////////////////////
// Set the content width based on the theme's design and stylesheet.
if ( ! isset( $content_width ) )
	$content_width = 860;


///////////////////////////////////////////////////////
// Add more colour selectors
add_action( 'customize_register', 'pinzolo_customize_register' );
function pinzolo_customize_register($wp_customize)
{
  $colors = array();
  $colors[] = array( 'slug'=>'link_color', 		'default' => '#56B33D', 	'label' => 'Link Color' );
  $colors[] = array( 'slug'=>'head_color', 		'default' => '#000000', 	'label' => 'H1, H2, H3 Color' );  

  foreach($colors as $color)
  {
    // SETTINGS
    $wp_customize->add_setting( $color['slug'], array( 'default' => $color['default'], 'type' => 'option', 'capability' => 'edit_theme_options' ));

    // CONTROLS
    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $color['slug'], array( 'label' => $color['label'], 'section' => 'colors', 'settings' => $color['slug'] )));
  }

	// Add Header Text
	$wp_customize->add_setting( 'header_text', array(
		'default'    => 'Pinzolo',
		'type'       => 'option',
		'capability' => 'edit_theme_options',
	) );
	$wp_customize->add_control( 'header_text', array(
		'label'      => 'Header Text',
		'section'    => 'title_tagline',
	) );


	// Add Sub Header Text
	$wp_customize->add_setting( 'sub_header_text', array(
		'default'    => 'Edit me in the Theme Customizer',
		'type'       => 'option',
		'capability' => 'edit_theme_options',
	) );
	$wp_customize->add_control( 'sub_header_text', array(
		'label'      => 'Sub Header Text',
		'section'    => 'title_tagline',
	) );
	
	
	// Add logo option 
	$wp_customize->add_setting( "logo", array(
		'type'       => 'option',
		'capability' => 'edit_theme_options',		
	) );
	$wp_customize->add_control(  new WP_Customize_Image_Control($wp_customize, 'logo', array(
		'label'    =>  'Upload a logo',
		'section'  => 'title_tagline',
	) ) );
	
		
	// Add border option
	$wp_customize->add_setting( "border", array(
		'default'    => true,
		'capability' => 'edit_theme_options',
		'type'       => 'option',
	) );
	$wp_customize->add_control( 'border', array(
		'label'    =>  'Show border / shadow?',
		'section'  => 'colors',
		'type'       => 'checkbox',
	) );

}

add_theme_support( 'custom-background', array(
	// Let WordPress know what our default background color is.
	// This is dependent on our current color scheme.
	'default-color' => '#F0F0F0',
) );	

add_theme_support( 'automatic-feed-links' );


///////////////////////////////////////////////////////
// Add support for custom headers.
$args = array(
	'width'         => 1400,
	'height'        => 260,
	'flex-width'    => true,
	'flex-height'    => true,
	'default-text-color' => '000000',
	'default-image' => get_template_directory_uri() . '/header/pinzolo.jpg',
);
add_theme_support( 'custom-header', $args );


///////////////////////////////////////////////////////
add_theme_support( 'post-thumbnails' );
add_image_size( 'page_header', 1400, 260, false );
add_image_size( 'portfolio', 250, 250, true );


///////////////////////////////////////////////////////
// Custom menu
add_action('init', 'register_custom_menu'); 
function register_custom_menu() {
	register_nav_menu('top', 'Top Menu');	
}

//to show a home link
function pinzolo_page_menu_args( $args ) {
	$args['show_home'] = true;
	return $args;
}
add_filter( 'wp_page_menu_args', 'pinzolo_page_menu_args' );


///////////////////////////////////////////////////////
// Search only posts
function pinzolo_SearchFilter($query) {
	if ($query->is_search) {
		$query->set('post_type', 'post');
	}
	return $query;
}
add_filter('pre_get_posts','pinzolo_SearchFilter');


///////////////////////////////////////////////////////
//Remove admin tool bar
function pinzolo_function_admin_bar(){
    return 0;
}
add_filter( 'show_admin_bar' , 'pinzolo_function_admin_bar');


///////////////////////////////////////////////////////
// Custom comments
function pinzolo_comment($comment, $args, $depth) {
	
	$GLOBALS['comment'] = $comment; ?>
	
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
	
	<div id="comment-<?php comment_ID(); ?>">	
	
	<p class="author">
		<?php echo get_avatar($comment,$size='30' ); ?>
		<?php printf('%s', get_comment_author_link()) ?>
	</p>
	
	<p class="time"><?php printf('%1$s at %2$s', get_comment_date(),  get_comment_time()) ?> | <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></p>
	
	<div class="clear"></div>
	
	<?php comment_text() ?>
	
	<?php if ($comment->comment_approved == '0') : ?>
		<em>Your comment is awaiting moderation</em>
	<?php endif; ?>
	
	</div>
	<?php
}
//Note the lack of a trailing </li>. WordPress will add it itself once it's done listing any children and whatnot.



///////////////////////////////////////////////////////
/**
* Plugin Name: PBD AJAX Load Posts
* Plugin URI: http://www.problogdesign.com/
* Description: Load the next page of posts with AJAX.
* Version: 0.1
* Author: Pro Blog Design
* Author URI: http://www.problogdesign.com/
*/

/**
* Initialization. Add our script if needed on this page.
*/
function pinzolo_pbd_alp_init() {
	global $wp_query;

	// Add code to index pages.
	if( !is_singular() ) {	
		// Queue JS and CSS
		wp_enqueue_script(
			'pbd-alp-load-posts',
			get_template_directory_uri('template_url') . '/js/load-posts.js',
			array('jquery'),
			'1.0',
			true
		); 	
		
		// What page are we on? And what is the pages limit?
		$max = $wp_query->max_num_pages;
		$paged = ( get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;
		
		// Add some parameters for the JS.
		wp_localize_script(
			'pbd-alp-load-posts',
			'pbd_alp',
			array(
				'startPage' => $paged,
				'maxPages' => $max,
				'nextLink' => next_posts($max, false)
			)
		);
	}
}
add_action('template_redirect', 'pinzolo_pbd_alp_init');

?>