2014-09-30 13:32:53 +03:00
|
|
|
<?php
|
2014-10-06 04:38:44 +03:00
|
|
|
|
|
|
|
# Add support for thumbnais
|
|
|
|
add_theme_support( 'post-thumbnails' );
|
|
|
|
|
|
|
|
|
2014-09-30 13:32:53 +03:00
|
|
|
register_nav_menus(
|
2014-10-04 17:31:15 +03:00
|
|
|
array( 'main-menu' => __( 'Main Menu', 'initfest' ),
|
2014-10-06 16:10:36 +03:00
|
|
|
'subnav-menu' => __( 'Sub Navigation', 'initfest'),
|
2014-10-04 17:31:15 +03:00
|
|
|
'footer-openfest' => __('OpenFest', 'initfest'),
|
|
|
|
'footer-openfest' => __('OpenFest', 'initfest'),
|
|
|
|
'footer-schedule' => __('Schedule', 'initfest'),
|
|
|
|
'footer-others' => __('Others', 'initfest'),
|
|
|
|
'footer-followus' => __('Follow us in:', 'initfest') )
|
2014-09-30 16:58:05 +03:00
|
|
|
);
|
|
|
|
|
2014-10-06 05:11:57 +03:00
|
|
|
|
|
|
|
# Register all shortcodes
|
|
|
|
function register_shortcodes(){
|
|
|
|
add_shortcode('sh-latest-posts', 'sh_latest_posts');
|
|
|
|
add_shortcode('sponsors', 'sponsors_shortcode');
|
|
|
|
add_shortcode('transport', 'transport_shortcode');
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action( 'init', 'register_shortcodes');
|
|
|
|
|
2014-09-30 16:58:05 +03:00
|
|
|
|
|
|
|
function sh_latest_posts($atts){
|
2014-10-04 17:31:15 +03:00
|
|
|
$atts = shortcode_atts( array(
|
|
|
|
'cat' => 'news',
|
|
|
|
'label' => __('News', 'initfest')
|
|
|
|
), $atts );
|
|
|
|
|
2014-10-06 04:38:44 +03:00
|
|
|
$result = '<section class="content"><h3>'.$atts['label'].' | <small><a href="'.esc_url(get_term_link($atts['cat'], 'category')).'">'.__('see all', 'initfest').'</a></small></h3><div class="grid">';
|
2014-10-04 17:31:15 +03:00
|
|
|
|
|
|
|
|
2014-10-06 04:38:44 +03:00
|
|
|
$news_args = array( 'catecory_name' => $cat, 'numberposts' => 3 );
|
|
|
|
$news = new WP_Query( $news_args );
|
|
|
|
|
2014-10-06 05:11:57 +03:00
|
|
|
ob_start();
|
|
|
|
|
2014-10-06 04:38:44 +03:00
|
|
|
if ( $news->have_posts() ) :
|
|
|
|
while ( $news->have_posts() ) : $news->the_post();
|
|
|
|
?>
|
|
|
|
<div class="col3">
|
|
|
|
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
|
|
|
|
<p class="info">От <?php the_author(); ?> | Публикувано на <?php the_date(); ?> </p>
|
|
|
|
<?php the_excerpt(); ?>
|
|
|
|
<a class="button" href="<?php the_permalink(); ?>">виж цялата новина</a>
|
|
|
|
</div>
|
|
|
|
<?php
|
|
|
|
endwhile;
|
|
|
|
endif;
|
|
|
|
|
2014-10-04 17:31:15 +03:00
|
|
|
$result .= ob_get_contents();
|
2014-10-06 04:38:44 +03:00
|
|
|
$result .='</div></section>';
|
2014-10-04 17:31:15 +03:00
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
2014-10-04 16:38:17 +03:00
|
|
|
}
|
|
|
|
|
2014-10-06 05:11:57 +03:00
|
|
|
|
|
|
|
# Create shortcode for sponsors
|
|
|
|
function sponsors_shortcode() {
|
|
|
|
$result= '<h3>Спонсори</h3>';
|
|
|
|
|
|
|
|
|
|
|
|
$sponsors_args = array( 'post_type' => 'sponsors', 'orderby' => 'rand' );
|
|
|
|
$sponsors = new WP_Query( $sponsors_args );
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
|
|
|
|
if ( $sponsors->have_posts() ) :
|
|
|
|
while ( $sponsors->have_posts() ) : $sponsors->the_post();
|
|
|
|
if ( has_post_thumbnail() ) {
|
|
|
|
the_post_thumbnail();
|
|
|
|
} else {
|
|
|
|
get_the_title();
|
|
|
|
}
|
|
|
|
endwhile;
|
|
|
|
endif;
|
|
|
|
|
|
|
|
$result .= ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Create shortcode for transport methods
|
|
|
|
function transport_shortcode() {
|
|
|
|
$result= '<section class="content"><h3>Място: Интерпред, София, България</h3>';
|
|
|
|
|
|
|
|
$transport_args = array( 'post_type' => 'transportation' );
|
|
|
|
$transport = new WP_Query( $transport_args );
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
|
|
|
|
if ( $transport->have_posts() ) :
|
|
|
|
while ( $transport->have_posts() ) : $transport->the_post();
|
|
|
|
?>
|
2014-10-06 16:10:36 +03:00
|
|
|
<h4><?php the_title(); ?></h4>
|
|
|
|
<p><?php the_content(); ?></p>
|
2014-10-06 05:11:57 +03:00
|
|
|
<?php
|
|
|
|
endwhile;
|
|
|
|
endif;
|
|
|
|
?>
|
|
|
|
</section>
|
|
|
|
<?php
|
|
|
|
echo do_shortcode( '[ready_google_map id="1" map_language="en" type="HYBRID" align="right"]' );
|
|
|
|
|
|
|
|
$result .= ob_get_contents();
|
|
|
|
ob_end_clean();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-04 16:38:17 +03:00
|
|
|
# Create a custom post type for Sponsors
|
|
|
|
function create_sponsors_posttype() {
|
|
|
|
|
2014-10-04 17:31:15 +03:00
|
|
|
$labels = array(
|
|
|
|
'name' => __( 'Sponsors' ),
|
|
|
|
'singular_name' => __( 'Sponsor' ),
|
2014-10-05 03:32:43 +03:00
|
|
|
'menu_name' => __( 'Sponsors'),
|
2014-10-04 17:31:15 +03:00
|
|
|
'all_items' => __( 'All Sponsors' ),
|
|
|
|
'view_item' => __( 'View Sponsor' ),
|
|
|
|
'add_new_item' => __( 'Add New Sponsor' ),
|
|
|
|
'add_new' => __( 'Add New' ),
|
|
|
|
'edit_item' => __( 'Edit Sponsor' ),
|
|
|
|
'update_item' => __( 'Update Sponsor' ),
|
|
|
|
'search_item' => __( 'Search Sponsor' ),
|
|
|
|
'not_found' => __( 'Not Found' ),
|
|
|
|
'not_found_in_trash' => __( 'Not Found In Trash' ),
|
|
|
|
);
|
2014-10-04 16:38:17 +03:00
|
|
|
|
2014-10-04 17:31:15 +03:00
|
|
|
$args = array(
|
|
|
|
'label' => __( 'sponsors' ),
|
|
|
|
'description' => __( 'Sponsors of OpenFest' ),
|
|
|
|
'labels' => $labels,
|
|
|
|
'supports' => array( 'title', 'excerpt', 'thumbnail', 'custom-fields', ),
|
|
|
|
'hierarchical' => false,
|
|
|
|
'public' => true,
|
|
|
|
'show_ui' => true,
|
|
|
|
'show_in_menu' => true,
|
|
|
|
'show_in_nav_menus' => true,
|
|
|
|
'show_in_admin_bar' => true,
|
|
|
|
'menu_position' => 5,
|
|
|
|
'can_export' => true,
|
|
|
|
'has_archive' => true,
|
|
|
|
'exclude_from_search' => false,
|
|
|
|
'publicly_queryable' => true,
|
|
|
|
'capability_type' => 'post',
|
|
|
|
);
|
2014-10-04 16:38:17 +03:00
|
|
|
|
2014-10-04 17:31:15 +03:00
|
|
|
register_post_type( 'sponsors', $args );
|
2014-10-04 16:38:17 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
add_action( 'init', create_sponsors_posttype );
|
|
|
|
|
2014-10-04 23:54:46 +03:00
|
|
|
|
2014-10-05 03:32:43 +03:00
|
|
|
# Create a custom post type for Speakers
|
|
|
|
function create_speakers_posttype() {
|
|
|
|
|
|
|
|
$labels = array(
|
|
|
|
'name' => __( 'Speakers' ),
|
|
|
|
'singular_name' => __( 'Speaker' ),
|
|
|
|
'menu_name' => __( 'Speakers'),
|
|
|
|
'all_items' => __( 'All Speakers' ),
|
|
|
|
'view_item' => __( 'View Speaker' ),
|
|
|
|
'add_new_item' => __( 'Add New Speaker' ),
|
|
|
|
'add_new' => __( 'Add New' ),
|
|
|
|
'edit_item' => __( 'Edit Speaker' ),
|
|
|
|
'update_item' => __( 'Update Speaker' ),
|
|
|
|
'search_item' => __( 'Search Speaker' ),
|
|
|
|
'not_found' => __( 'Not Found' ),
|
|
|
|
'not_found_in_trash' => __( 'Not Found In Trash' ),
|
|
|
|
);
|
|
|
|
|
|
|
|
$args = array(
|
|
|
|
'label' => __( 'speakers' ),
|
|
|
|
'description' => __( 'Speakers on OpenFest' ),
|
|
|
|
'labels' => $labels,
|
|
|
|
'supports' => array( 'title', 'excerpt', 'thumbnail', 'custom-fields', ),
|
|
|
|
'hierarchical' => false,
|
|
|
|
'public' => true,
|
|
|
|
'show_ui' => true,
|
|
|
|
'show_in_menu' => true,
|
|
|
|
'show_in_nav_menus' => true,
|
|
|
|
'show_in_admin_bar' => true,
|
|
|
|
'menu_position' => 6,
|
|
|
|
'can_export' => true,
|
|
|
|
'has_archive' => true,
|
|
|
|
'exclude_from_search' => false,
|
|
|
|
'publicly_queryable' => true,
|
|
|
|
'capability_type' => 'post',
|
|
|
|
);
|
|
|
|
|
|
|
|
register_post_type( 'speakers', $args );
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action( 'init', create_speakers_posttype );
|
|
|
|
|
|
|
|
|
2014-10-04 23:54:46 +03:00
|
|
|
# Create a custom post type for Tranportation
|
|
|
|
function transportation_posttype() {
|
|
|
|
|
|
|
|
register_post_type( 'transportation',
|
|
|
|
array(
|
|
|
|
'labels' => array(
|
|
|
|
'name' => __( 'Tranportation' ),
|
|
|
|
),
|
|
|
|
'public' => true,
|
|
|
|
'has_archive' => true,
|
|
|
|
'rewrite' => array('slug' => 'transportation'),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
add_action( 'init', 'transportation_posttype' );
|
|
|
|
|
2014-10-04 16:38:17 +03:00
|
|
|
?>
|