This commit is contained in:
Alexander Yakovlev 2017-06-12 21:08:09 +07:00
parent 0638386a7b
commit 6afe1c2a48
3 changed files with 333 additions and 333 deletions

View File

@ -1,41 +1,41 @@
$(function(){
$(".circle-1").height($(".circle-1").width())
$(".small-circle").height($(".small-circle").width())
$(".circle-2").height($(".circle-2").width())
$(".circle-3").height($(".circle-3").width())
$(".circle-4").height($(".circle-4").width())
$(".humans").height($(".humans").width())
$(".humans img").height($(".humans img").width())
$(".avatars").height($(".avatars").width())
$(window).on("resize",function(){
$(".circle-1").height($(".circle-1").width())
$(".small-circle").height($(".small-circle").width())
$(".circle-2").height($(".circle-2").width())
$(".circle-3").height($(".circle-3").width())
$(".circle-4").height($(".circle-4").width())
$(".avatars").height($(".avatars").width())
$(".humans").height($(".humans").width())
(".humans img").height($(".humans img").width())
})
var speed=50;
var border_color="#cacbce";
var img_border_color="#cacbce";
$(".circles").css("border-color",border_color);
$(".avatars,.humans").css({"animation-duration":speed+"s","-webkit-animation-duration":speed+"s"});
for(var i=0;i<$(".small-circle").length;i++){
var r=Math.round(Math.random()*255);
var g=Math.round(Math.random()*255);
var b=Math.round(Math.random()*255);
$(".small-circle").eq(i).css("border-color","rgb("+r+","+g+","+b+")");
}
$(".humans").hover(function(){
$(this).find("img").css({"border":"5px double "+img_border_color});
$(this).find("div").css({"padding":"10%","display":"block"});
},
function(){
$(this).find("img").css({"border":"1px solid "+img_border_color});
$(this).find("div").css("display","none");
})
$(function(){
$(".circle-1").height($(".circle-1").width())
$(".small-circle").height($(".small-circle").width())
$(".circle-2").height($(".circle-2").width())
$(".circle-3").height($(".circle-3").width())
$(".circle-4").height($(".circle-4").width())
$(".humans").height($(".humans").width())
$(".humans img").height($(".humans img").width())
$(".avatars").height($(".avatars").width())
$(window).on("resize",function(){
$(".circle-1").height($(".circle-1").width())
$(".small-circle").height($(".small-circle").width())
$(".circle-2").height($(".circle-2").width())
$(".circle-3").height($(".circle-3").width())
$(".circle-4").height($(".circle-4").width())
$(".avatars").height($(".avatars").width())
$(".humans").height($(".humans").width())
(".humans img").height($(".humans img").width())
})
var speed=50;
var border_color="#cacbce";
var img_border_color="#cacbce";
$(".circles").css("border-color",border_color);
$(".avatars,.humans").css({"animation-duration":speed+"s","-webkit-animation-duration":speed+"s"});
for(var i=0;i<$(".small-circle").length;i++){
var r=Math.round(Math.random()*255);
var g=Math.round(Math.random()*255);
var b=Math.round(Math.random()*255);
$(".small-circle").eq(i).css("border-color","rgb("+r+","+g+","+b+")");
}
$(".humans").hover(function(){
$(this).find("img").css({"border":"5px double "+img_border_color});
$(this).find("div").css({"padding":"10%","display":"block"});
},
function(){
$(this).find("img").css({"border":"1px solid "+img_border_color});
$(this).find("div").css("display","none");
})
})

378
style.css

File diff suppressed because one or more lines are too long

View File

@ -1,104 +1,104 @@
<?php
/*
Plugin Name: UserGalaxy
Description: A special page with a list of users
Version: 1.0.0
Author: Alexander Yakovlev
Text Domain: usergalaxy
*/
function imbb_posttype(){
register_post_type( 'team',
array(
'labels' => array(
'name' => __( 'Team' ),
'singular_name' => __( 'Employee' )
),
'public' => true,
'has_archive' => false,
'rewrite' => array(
'slug' => 'team'
),
)
);
}
function imbb_register_metabox() {
$prefix = 'imbb_';
$cmb = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Options', 'cmb2' ),
'object_types' => array( 'team', ), // Post type
));
$cmb->add_field( array(
'name' => esc_html__( 'Designation', 'cmb2' ),
'desc' => esc_html__( 'Role in the team', 'cmb2' ),
'id' => $prefix . 'designation',
'type' => 'text_small',
));
$cmb->add_field( array(
'name' => esc_html__( 'Portrait', 'cmb2' ),
'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ),
'id' => $prefix . 'image',
'type' => 'file',
) );
}
function imbb_usergalaxy() {
wp_enqueue_style( 'imbb_style', plugin_dir_url( __FILE__ ) . '/style.css' );
$query = new WP_Query(array(
'post_type' => 'team',
'post_status' => 'publish',
'posts_per_page' => -1,
));
?>
<div class="all">
<div class="container">
<div class="circles circle-1">
<?php
for ($i = 1; $i <= $query->found_posts; $i++) {
?>
<div class="small-circle small-<?php echo $i ?>"></div>
<?php
}
?>
<div class="avatars">
<?php
$i = 1;
while ($query->have_posts()) {
?>
<a href="#" id="human-<?php echo $i ?>" target="_blank" class="humans">
<img src="<?php echo get_post_meta( get_the_ID(), 'imbb_image', TRUE ) ?>" alt="<?php echo get_title() ?>">
<div class="texts box">
<?php echo $query->the_post(); ?>
<span class="name">
<?php echo get_post_meta( get_the_ID(), 'imbb_designation', TRUE ); ?>
</span>
</div>
</a>
<?php
$i++;
}
?>
<div class="circles circle-2">
<div class="circles circle-3">
<div class="circles circle-4">
<?php // <img src="images/11.jpeg" style="position:absolute; top:40%; left:40%; border-radius:50%;" /> ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
wp_reset_query();
}
function imbb_scripts() {
wp_register_script( 'imbb_script', plugin_dir_url( __FILE__ ) . '/script.js', array('jquery'), '1.1.0', true );
wp_enqueue_script( 'imbb_script' );
}
add_action( 'wp_enqueue_scripts', 'imbb_scripts' );
add_shortcode('usergalaxy', 'imbb_usergalaxy');
add_action( 'init', 'imbb_posttype' );
add_action( 'cmb2_admin_init', 'imbb_register_metabox' );
<?php
/*
Plugin Name: UserGalaxy
Description: A special page with a list of users
Version: 1.0.0
Author: Alexander Yakovlev
Text Domain: usergalaxy
*/
function imbb_posttype(){
register_post_type( 'team',
array(
'labels' => array(
'name' => __( 'Team' ),
'singular_name' => __( 'Employee' )
),
'public' => true,
'has_archive' => false,
'rewrite' => array(
'slug' => 'team'
),
)
);
}
function imbb_register_metabox() {
$prefix = 'imbb_';
$cmb = new_cmb2_box( array(
'id' => $prefix . 'metabox',
'title' => esc_html__( 'Options', 'cmb2' ),
'object_types' => array( 'team', ), // Post type
));
$cmb->add_field( array(
'name' => esc_html__( 'Designation', 'cmb2' ),
'desc' => esc_html__( 'Role in the team', 'cmb2' ),
'id' => $prefix . 'designation',
'type' => 'text_small',
));
$cmb->add_field( array(
'name' => esc_html__( 'Portrait', 'cmb2' ),
'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ),
'id' => $prefix . 'image',
'type' => 'file',
) );
}
function imbb_usergalaxy() {
wp_enqueue_style( 'imbb_style', plugin_dir_url( __FILE__ ) . '/style.css' );
$query = new WP_Query(array(
'post_type' => 'team',
'post_status' => 'publish',
'posts_per_page' => -1,
));
?>
<div class="all">
<div class="container">
<div class="circles circle-1">
<?php
for ($i = 1; $i <= $query->found_posts; $i++) {
?>
<div class="small-circle small-<?php echo $i ?>"></div>
<?php
}
?>
<div class="avatars">
<?php
$i = 1;
while ($query->have_posts()) {
?>
<a href="#" id="human-<?php echo $i ?>" target="_blank" class="humans">
<img src="<?php echo get_post_meta( get_the_ID(), 'imbb_image', TRUE ) ?>" alt="<?php echo get_title() ?>">
<div class="texts box">
<?php echo $query->the_post(); ?>
<span class="name">
<?php echo get_post_meta( get_the_ID(), 'imbb_designation', TRUE ); ?>
</span>
</div>
</a>
<?php
$i++;
}
?>
<div class="circles circle-2">
<div class="circles circle-3">
<div class="circles circle-4">
<?php // <img src="images/11.jpeg" style="position:absolute; top:40%; left:40%; border-radius:50%;" /> ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
wp_reset_query();
}
function imbb_scripts() {
wp_register_script( 'imbb_script', plugin_dir_url( __FILE__ ) . '/script.js', array('jquery'), '1.1.0', true );
wp_enqueue_script( 'imbb_script' );
}
add_action( 'wp_enqueue_scripts', 'imbb_scripts' );
add_shortcode('usergalaxy', 'imbb_usergalaxy');
add_action( 'init', 'imbb_posttype' );
add_action( 'cmb2_admin_init', 'imbb_register_metabox' );