File: D:/HostingSpaces/KLeeuwen/old.samenbouwen.in/wwwroot/wp-content/themes/samenbouwenin/functions.php
<?php
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'projecten',
array(
'labels' => array(
'name' => __( 'Projecten' ),
'singular_name' => __( 'Projecten' )
),
'public' => true,
'has_archive' => true,
)
);
}
add_action( 'init', 'create_post_type_blog' );
function create_post_type_blog() {
register_post_type( 'blogs',
array(
'labels' => array(
'name' => __( 'In het nieuws' ),
'singular_name' => __( 'In het nieuws' )
),
'public' => true,
'has_archive' => true,
'taxonomies' => array('post_tag'),
'rewrite' => array('slug' => 'in-het-nieuws'),
)
);
}
add_action( 'init', 'create_post_type_team' );
function create_post_type_team() {
register_post_type( 'team',
array(
'labels' => array(
'name' => __( 'Team' ),
'singular_name' => __( 'Team' )
),
'public' => true,
'has_archive' => true,
)
);
}
function register_my_menu() {
register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'Sidebar',
'before_widget' => '<div class="sidebox">',
'after_widget' => '</div><div class="clear"></div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'footer1',
'before_widget' => '<div class="sidebox">',
'after_widget' => '</div><div class="clear"></div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'footer2',
'before_widget' => '<div class="sidebox">',
'after_widget' => '</div><div class="clear"></div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'footer3',
'before_widget' => '<div class="sidebox">',
'after_widget' => '</div><div class="clear"></div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'adres1',
'before_widget' => '<div class="sidebox">',
'after_widget' => '</div><div class="clear"></div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
register_sidebar(array(
'name' => 'adres2',
'before_widget' => '<div class="sidebox">',
'after_widget' => '</div><div class="clear"></div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
}
function slider_cpt() {
register_post_type( 'slider', array(
'labels' => array(
'name' => 'Slider',
'singular_name' => 'Slider',
),
'description' => 'Slider',
'public' => true,
'menu_position' => 20,
'supports' => array( 'title','custom-fields' )
));
}
add_action( 'init', 'slider_cpt' );
/* Add a custom field to the field editor (See editor screenshot) */
add_action("gform_field_standard_settings", "my_standard_settings", 10, 2);
function my_standard_settings($position, $form_id){
// Create settings on position 25 (right after Field Label)
if($position == 25){
echo '
<li class="admin_label_setting field_setting" style="display: list-item; ">
<label for="field_placeholder">Placeholder Text
<!-- Tooltip to help users understand what this field does -->
<a href="javascript:void(0);" class="tooltip tooltip_form_field_placeholder" tooltip="<h6>Placeholder</h6>Enter the placeholder/default text for this field.">(?)</a>
</label>
<input type="text" id="field_placeholder" class="fieldwidth-3" size="35" onkeyup="SetFieldProperty(\'placeholder\', this.value);">
</li>';
}
}
/* Now we execute some javascript technicalitites for the field to load correctly */
add_action("gform_editor_js", "my_gform_editor_js");
function my_gform_editor_js(){
echo '
<script>
//binding to the load field settings event to initialize the checkbox
jQuery(document).bind("gform_load_field_settings", function(event, field, form){
jQuery("#field_placeholder").val(field["placeholder"]);
});
</script>';
}
/* We use jQuery to read the placeholder value and inject it to its field */
add_action('gform_enqueue_scripts',"my_gform_enqueue_scripts", 10, 2);
function my_gform_enqueue_scripts($form, $is_ajax=false){
echo '
<script>
jQuery(function(){';
/* Go through each one of the form fields */
foreach($form['fields'] as $i=>$field){
/* Check if the field has an assigned placeholder */
if(isset($field['placeholder']) && !empty($field['placeholder'])){
/* If a placeholder text exists, inject it as a new property to the field using jQuery */
echo '
jQuery(\'#input_'.$form['id'].'_'.$field['id'].'\').attr(\'placeholder\',\''.$field['placeholder'].'\');';
}
}
echo '
});
</script>';
}
if ( ! function_exists( 'shape_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @since Shape 1.0
*/
function shape_posted_on() {
printf( __( 'Posted on <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="byline"> by <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'shape' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'shape' ), get_the_author() ) ),
esc_html( get_the_author() )
);
}
endif;
/**
* Returns true if a blog has more than 1 category
*
* @since Shape 1.0
*/
function shape_categorized_blog() {
if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) {
// Create an array of all the categories that are attached to posts
$all_the_cool_cats = get_categories( array(
'hide_empty' => 1,
) );
// Count the number of categories that are attached to the posts
$all_the_cool_cats = count( $all_the_cool_cats );
set_transient( 'all_the_cool_cats', $all_the_cool_cats );
}
if ( '1' != $all_the_cool_cats ) {
// This blog has more than 1 category so shape_categorized_blog should return true
return true;
} else {
// This blog has only 1 category so shape_categorized_blog should return false
return false;
}
}
/**
* Flush out the transients used in shape_categorized_blog
*
* @since Shape 1.0
*/
function shape_category_transient_flusher() {
// Like, beat it. Dig?
delete_transient( 'all_the_cool_cats' );
}
add_action( 'edit_category', 'shape_category_transient_flusher' );
add_action( 'save_post', 'shape_category_transient_flusher' );
add_image_size( 'project-medium', 370, 190, true ); // (cropped)
add_image_size( 'project-large', 1170, 700, true ); // (cropped)
add_image_size( 'project-medium2', 570, 390, true );
add_image_size( 'project-medium3', 770, 527, true );
add_image_size( 'blog-thumbnail', 72, 72, true );
add_image_size( 'blog-medium', 290, 290, true );
function the_breadcrumb() {
//if (!is_home()) {
echo '<p id="breadcrumbs"><a href="';
echo get_option('home');
echo '">';
bloginfo('name');
echo "</a> » ";
if (is_category() || is_single()) {
the_category('title_li=');
//$category = get_the_category();
//$category = $category[0];
//echo '<a href="'.get_category_link( get_cat_ID($category->name) ).'">'.$category->name.'</a>';
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
echo '</p>';
//}
}