Commit 682052a8 authored by agnez's avatar agnez

event calendar

parent a0c877b5
......@@ -318,32 +318,31 @@ add_filter( 'radio-buttons-for-taxonomies-no-term-gasaptype', '__return_FALSE' )
add_filter( 'radio-buttons-for-taxonomies-no-term-gasapday', '__return_FALSE' );
// ---rename Post to News http://revelationconcept.com/wordpress-rename-default-posts-news-something-else/
function gasap_change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = __( 'News', 'gasap-posttypes' );
$submenu['edit.php'][5][0] = __( 'News', 'gasap-posttypes' );
$submenu['edit.php'][10][0] = __( 'Add News', 'gasap-posttypes' );
$submenu['edit.php'][16][0] = __( 'News Tags', 'gasap-posttypes' );
echo '';
}
function gasap_change_post_object() {
global $wp_post_types;
$labels = &$wp_post_types['post']->labels;
$labels->name = _x( 'News', 'post type general name', 'gasap-posttypes' );
$labels->singular_name = _x( 'News', 'post type singular name', 'gasap-posttypes' );
$labels->add_new = _x( 'Add New', 'News', 'gasap-posttypes' );
$labels->add_new_item = __( 'Add News', 'gasap-posttypes' );
$labels->edit_item = __( 'Edit News', 'gasap-posttypes' );
$labels->new_item = __( 'News', 'gasap-posttypes' );
$labels->view_item = __( 'View News', 'gasap-posttypes' );
$labels->search_items = __( 'Search News', 'gasap-posttypes' );
$labels->not_found = __( 'No News found', 'gasap-posttypes' );
$labels->not_found_in_trash = __( 'No News found in Trash', 'gasap-posttypes' );
$labels->all_items = __( 'All', 'gasap-posttypes' );
$labels->menu_name = __( 'News', 'gasap-posttypes' );
$labels->name_admin_bar = __( 'News', 'gasap-posttypes' );
}
function gasap_change_post_label() {
global $menu;
global $submenu;
$menu[5][0] = __( 'News', 'gasap-posttypes' );
$submenu['edit.php'][5][0] = __( 'News', 'gasap-posttypes' );
$submenu['edit.php'][10][0] = __( 'Add News', 'gasap-posttypes' );
//$submenu['edit.php'][16][0] = __( 'News Tags', 'gasap-posttypes' );
}
function gasap_change_post_object() {
global $wp_post_types;
$labels = &$wp_post_types['post']->labels;
$labels->name = _x( 'News', 'post type general name', 'gasap-posttypes' );
$labels->singular_name = _x( 'News', 'post type singular name', 'gasap-posttypes' );
$labels->add_new = _x( 'Add New', 'News', 'gasap-posttypes' );
$labels->add_new_item = __( 'Add News', 'gasap-posttypes' );
$labels->edit_item = __( 'Edit News', 'gasap-posttypes' );
$labels->new_item = __( 'News', 'gasap-posttypes' );
$labels->view_item = __( 'View News', 'gasap-posttypes' );
$labels->search_items = __( 'Search News', 'gasap-posttypes' );
$labels->not_found = __( 'No News found', 'gasap-posttypes' );
$labels->not_found_in_trash = __( 'No News found in Trash', 'gasap-posttypes' );
$labels->all_items = __( 'All', 'gasap-posttypes' );
$labels->menu_name = __( 'News', 'gasap-posttypes' );
$labels->name_admin_bar = __( 'News', 'gasap-posttypes' );
}
add_action( 'admin_menu', 'gasap_change_post_label' );
add_action( 'init', 'gasap_change_post_object' );
......@@ -388,6 +387,7 @@ function gasap_add_usage_taxonomy() {
unset($menu[4]);
unset($menu[10]);
unset($menu[20]);
add_menu_page( __( 'Event', 'gasap-posttypes' ),'Event','page','edit.php?post_type=event','','',5 );
if ( !current_user_can( 'manage_options' ) ){
remove_menu_page( 'tools.php' );
remove_submenu_page( 'edit.php?post_type=gasap', 'edit-tags.php?taxonomy=gasaptype&post_type=gasap' );
......@@ -545,7 +545,7 @@ function gasap_remove_post_meta_boxes() {
}
/**
* Rename author meta boxes in GASAP poste tyoes
* Rename author meta boxes in GASAP poste types
*/
add_action( 'add_meta_boxes_gasap', 'gasap_rename_metabox' );
function gasap_rename_metabox( $post ) {
......
......@@ -256,6 +256,14 @@ main .uk-container{
background-color: @bleu-ciel;
padding: 3em 0;
}
#snippet_event_calendar{
background-color: @bleu-ciel;
padding: 1em 0;
margin-bottom: 3em;
.uk-panel{
background-color: white;
}
}
#gasap-footer{
background-color: @global-muted-color;
color: white;
......
......@@ -97,23 +97,11 @@ function wp_get_attachment( $attachment_id ) {
);
}
// Register custom widget area.
add_action( 'widgets_init', 'example_widget_areas' );
function example_widget_areas() {
// Register calendar widget area to use in home.php
add_action( 'widgets_init', 'calendar_widget_areas' );
function calendar_widget_areas() {
beans_register_widget_area( array(
'name' => __( 'Example Widget Area', 'beans_gasap' ),
'id' => 'example_widget_area',
'name' => __( 'Calendar Widget Area', 'beans_gasap' ),
'id' => 'calendar_widget_area',
) );
}
// Append custom HTML to the Primary Sidebar.
add_action( 'beans_sidebar_primary_append_markup', 'example_widget_area_custom_html' );
function example_widget_area_custom_html() {
?><div class="uk-panel">ggggggggggggggggggggggggggg</div><?php
}
// Append custom widget area to the Primary Sidebar.
add_action( 'beans_sidebar_primary_append_markup', 'example_custom_widget_area' );
function example_custom_widget_area() {
echo beans_widget_area( 'example_widget_area' );
}
\ No newline at end of file
......@@ -9,12 +9,12 @@ add_action( 'beans_content_prepend_markup', 'gasap_latest_news' );
function gasap_latest_news() {
$do_not_duplicate = array();?>
<article id="snippet_latest_news" class="uk-article"><?php
$latest_news = new WP_Query( array(
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'posts_per_page' => 1
));
$latest_news = new WP_Query( array(
'post_type' => 'post',
'orderby' => 'post_date',
'order' => 'DESC',
'posts_per_page' => 1
));
while ( $latest_news->have_posts() ) : $latest_news->the_post();
$do_not_duplicate[] = get_the_ID();?>
<div>
......@@ -26,8 +26,10 @@ function gasap_latest_news() {
</div>
<a class="uk-position-cover" href="<?php echo get_the_permalink(); ?>"></a>
</figure>
<div><?php the_content(); ?></div>
<?php edit_post_link( esc_html__( 'Edit news', 'beans_gasap' ), '<span class="edit-link">', '</span>' ); ?>
<div class="largeur1">
<div><?php the_content(); ?></div>
<?php edit_post_link( esc_html__( 'Edit news', 'beans_gasap' ), '<span class="edit-link">', '</span>' ); ?>
</div>
</div><?php
endwhile;
wp_reset_postdata(); ?>
......@@ -42,7 +44,7 @@ $loop2 = new WP_Query( array(
'posts_per_page' => 3,
'post__not_in' => $do_not_duplicate
));?>
<div class="uk-grid uk-grid-small largeur2" data-uk-grid-margin><?php
<div class="uk-grid uk-grid-small largeur1" data-uk-grid-margin><?php
while ( $loop2->have_posts() ) : $loop2->the_post();
$random_number = wp_rand( 1, 3 ); ?>
<div class="uk-width-1 uk-width-small-1-2 uk-width-medium-1-3">
......@@ -61,10 +63,67 @@ $loop2 = new WP_Query( array(
wp_reset_postdata(); ?>
</div>
</section><?php
}
add_action( 'beans_content_after_markup', 'calendar_section_with_widget_area' );
function calendar_section_with_widget_area() {
$argsevent_one = array(
'post_type' => 'event',
'posts_per_page' => 1,
'orderby' => 'eventstart',
'event_end_after' => 'now',
'order' => 'ASC'
);
$argsevents = array(
'post_type' => 'event',
'offset' => 1,
'posts_per_page' => 2,
'orderby' => 'eventstart',
'event_end_after' => 'now',
'order' => 'ASC'
);
$event_one = new WP_Query( $argsevent_one );
$events = new WP_Query( $argsevents ); ?>
<section id="snippet_event_calendar">
<h2><?php esc_html_e( 'Calendrier', 'beans_gasap' ); ?></h2>
<div class="uk-grid uk-grid-small uk-grid-match largeur1" data-uk-grid-match>
<div class="uk-width-1 uk-width-medium-1-3">
<div class="uk-panel"><?php echo beans_widget_area( 'calendar_widget_area' ); // Output widget area above the footer. ?></div>
</div><?php
while ( $event_one->have_posts() ) : $event_one->the_post();?>
<div class="uk-width-1 uk-width-medium-1-3">
<div class="uk-panel"><?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?></div>
</div>
<div class="uk-width-1 uk-width-small-1-3">
<div class="uk-panel">
<h3><?php the_title(); ?></h3><?php
the_content();
edit_post_link( esc_html__( 'Edit snippet', 'beans_gasap' ), '<span class="edit-link">', '</span>' );?>
</div>
</div><?php
endwhile;
while ( $events->have_posts() ) : $events->the_post();?>
<div class="uk-width-1 uk-width-small-1-2">
<div class="uk-panel">
<h3><?php the_title(); ?></h3><?php
the_content();
edit_post_link( esc_html__( 'Edit snippet', 'beans_gasap' ), '<span class="edit-link">', '</span>' );?>
</div>
</div><?php
endwhile;
wp_reset_postdata();?>
</div>
</section><?php
}
beans_remove_action( 'beans_loop_template' );
add_action( 'beans_content_after_markup', 'gasap_bottom' );
function gasap_bottom() {
include (get_stylesheet_directory() . '/assets/template_parts/contact_calendar.php');
......
......@@ -37,13 +37,6 @@ function page_contact_before() {
</div>
</div></article>
TEST
<?php if ( dynamic_sidebar('sidebar_primary') ) : else : endif; ?>
<?php if ( dynamic_sidebar('example_widget_area') ) : else : endif; ?>
<?php echo todays_events(); ?>
<?php echo upcoming_events(); ?>
TEST
<article id="snippet_contact_prod">
<div class="uk-text-center"><?php
$contact_producteurs = new WP_Query( array( 'post_type' => 'contentpiece','p' => 692) ); //FIX db entry
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment