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(){ $(function(){
$(".circle-1").height($(".circle-1").width()) $(".circle-1").height($(".circle-1").width())
$(".small-circle").height($(".small-circle").width()) $(".small-circle").height($(".small-circle").width())
$(".circle-2").height($(".circle-2").width()) $(".circle-2").height($(".circle-2").width())
$(".circle-3").height($(".circle-3").width()) $(".circle-3").height($(".circle-3").width())
$(".circle-4").height($(".circle-4").width()) $(".circle-4").height($(".circle-4").width())
$(".humans").height($(".humans").width()) $(".humans").height($(".humans").width())
$(".humans img").height($(".humans img").width()) $(".humans img").height($(".humans img").width())
$(".avatars").height($(".avatars").width()) $(".avatars").height($(".avatars").width())
$(window).on("resize",function(){ $(window).on("resize",function(){
$(".circle-1").height($(".circle-1").width()) $(".circle-1").height($(".circle-1").width())
$(".small-circle").height($(".small-circle").width()) $(".small-circle").height($(".small-circle").width())
$(".circle-2").height($(".circle-2").width()) $(".circle-2").height($(".circle-2").width())
$(".circle-3").height($(".circle-3").width()) $(".circle-3").height($(".circle-3").width())
$(".circle-4").height($(".circle-4").width()) $(".circle-4").height($(".circle-4").width())
$(".avatars").height($(".avatars").width()) $(".avatars").height($(".avatars").width())
$(".humans").height($(".humans").width()) $(".humans").height($(".humans").width())
(".humans img").height($(".humans img").width()) (".humans img").height($(".humans img").width())
}) })
var speed=50; var speed=50;
var border_color="#cacbce"; var border_color="#cacbce";
var img_border_color="#cacbce"; var img_border_color="#cacbce";
$(".circles").css("border-color",border_color); $(".circles").css("border-color",border_color);
$(".avatars,.humans").css({"animation-duration":speed+"s","-webkit-animation-duration":speed+"s"}); $(".avatars,.humans").css({"animation-duration":speed+"s","-webkit-animation-duration":speed+"s"});
for(var i=0;i<$(".small-circle").length;i++){ for(var i=0;i<$(".small-circle").length;i++){
var r=Math.round(Math.random()*255); var r=Math.round(Math.random()*255);
var g=Math.round(Math.random()*255); var g=Math.round(Math.random()*255);
var b=Math.round(Math.random()*255); var b=Math.round(Math.random()*255);
$(".small-circle").eq(i).css("border-color","rgb("+r+","+g+","+b+")"); $(".small-circle").eq(i).css("border-color","rgb("+r+","+g+","+b+")");
} }
$(".humans").hover(function(){ $(".humans").hover(function(){
$(this).find("img").css({"border":"5px double "+img_border_color}); $(this).find("img").css({"border":"5px double "+img_border_color});
$(this).find("div").css({"padding":"10%","display":"block"}); $(this).find("div").css({"padding":"10%","display":"block"});
}, },
function(){ function(){
$(this).find("img").css({"border":"1px solid "+img_border_color}); $(this).find("img").css({"border":"1px solid "+img_border_color});
$(this).find("div").css("display","none"); $(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 <?php
/* /*
Plugin Name: UserGalaxy Plugin Name: UserGalaxy
Description: A special page with a list of users Description: A special page with a list of users
Version: 1.0.0 Version: 1.0.0
Author: Alexander Yakovlev Author: Alexander Yakovlev
Text Domain: usergalaxy Text Domain: usergalaxy
*/ */
function imbb_posttype(){ function imbb_posttype(){
register_post_type( 'team', register_post_type( 'team',
array( array(
'labels' => array( 'labels' => array(
'name' => __( 'Team' ), 'name' => __( 'Team' ),
'singular_name' => __( 'Employee' ) 'singular_name' => __( 'Employee' )
), ),
'public' => true, 'public' => true,
'has_archive' => false, 'has_archive' => false,
'rewrite' => array( 'rewrite' => array(
'slug' => 'team' 'slug' => 'team'
), ),
) )
); );
} }
function imbb_register_metabox() { function imbb_register_metabox() {
$prefix = 'imbb_'; $prefix = 'imbb_';
$cmb = new_cmb2_box( array( $cmb = new_cmb2_box( array(
'id' => $prefix . 'metabox', 'id' => $prefix . 'metabox',
'title' => esc_html__( 'Options', 'cmb2' ), 'title' => esc_html__( 'Options', 'cmb2' ),
'object_types' => array( 'team', ), // Post type 'object_types' => array( 'team', ), // Post type
)); ));
$cmb->add_field( array( $cmb->add_field( array(
'name' => esc_html__( 'Designation', 'cmb2' ), 'name' => esc_html__( 'Designation', 'cmb2' ),
'desc' => esc_html__( 'Role in the team', 'cmb2' ), 'desc' => esc_html__( 'Role in the team', 'cmb2' ),
'id' => $prefix . 'designation', 'id' => $prefix . 'designation',
'type' => 'text_small', 'type' => 'text_small',
)); ));
$cmb->add_field( array( $cmb->add_field( array(
'name' => esc_html__( 'Portrait', 'cmb2' ), 'name' => esc_html__( 'Portrait', 'cmb2' ),
'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ), 'desc' => esc_html__( 'Upload an image or enter a URL.', 'cmb2' ),
'id' => $prefix . 'image', 'id' => $prefix . 'image',
'type' => 'file', 'type' => 'file',
) ); ) );
} }
function imbb_usergalaxy() { function imbb_usergalaxy() {
wp_enqueue_style( 'imbb_style', plugin_dir_url( __FILE__ ) . '/style.css' ); wp_enqueue_style( 'imbb_style', plugin_dir_url( __FILE__ ) . '/style.css' );
$query = new WP_Query(array( $query = new WP_Query(array(
'post_type' => 'team', 'post_type' => 'team',
'post_status' => 'publish', 'post_status' => 'publish',
'posts_per_page' => -1, 'posts_per_page' => -1,
)); ));
?> ?>
<div class="all"> <div class="all">
<div class="container"> <div class="container">
<div class="circles circle-1"> <div class="circles circle-1">
<?php <?php
for ($i = 1; $i <= $query->found_posts; $i++) { for ($i = 1; $i <= $query->found_posts; $i++) {
?> ?>
<div class="small-circle small-<?php echo $i ?>"></div> <div class="small-circle small-<?php echo $i ?>"></div>
<?php <?php
} }
?> ?>
<div class="avatars"> <div class="avatars">
<?php <?php
$i = 1; $i = 1;
while ($query->have_posts()) { while ($query->have_posts()) {
?> ?>
<a href="#" id="human-<?php echo $i ?>" target="_blank" class="humans"> <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() ?>"> <img src="<?php echo get_post_meta( get_the_ID(), 'imbb_image', TRUE ) ?>" alt="<?php echo get_title() ?>">
<div class="texts box"> <div class="texts box">
<?php echo $query->the_post(); ?> <?php echo $query->the_post(); ?>
<span class="name"> <span class="name">
<?php echo get_post_meta( get_the_ID(), 'imbb_designation', TRUE ); ?> <?php echo get_post_meta( get_the_ID(), 'imbb_designation', TRUE ); ?>
</span> </span>
</div> </div>
</a> </a>
<?php <?php
$i++; $i++;
} }
?> ?>
<div class="circles circle-2"> <div class="circles circle-2">
<div class="circles circle-3"> <div class="circles circle-3">
<div class="circles circle-4"> <div class="circles circle-4">
<?php // <img src="images/11.jpeg" style="position:absolute; top:40%; left:40%; border-radius:50%;" /> ?> <?php // <img src="images/11.jpeg" style="position:absolute; top:40%; left:40%; border-radius:50%;" /> ?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php <?php
wp_reset_query(); wp_reset_query();
} }
function imbb_scripts() { function imbb_scripts() {
wp_register_script( 'imbb_script', plugin_dir_url( __FILE__ ) . '/script.js', array('jquery'), '1.1.0', true ); wp_register_script( 'imbb_script', plugin_dir_url( __FILE__ ) . '/script.js', array('jquery'), '1.1.0', true );
wp_enqueue_script( 'imbb_script' ); wp_enqueue_script( 'imbb_script' );
} }
add_action( 'wp_enqueue_scripts', 'imbb_scripts' ); add_action( 'wp_enqueue_scripts', 'imbb_scripts' );
add_shortcode('usergalaxy', 'imbb_usergalaxy'); add_shortcode('usergalaxy', 'imbb_usergalaxy');
add_action( 'init', 'imbb_posttype' ); add_action( 'init', 'imbb_posttype' );
add_action( 'cmb2_admin_init', 'imbb_register_metabox' ); add_action( 'cmb2_admin_init', 'imbb_register_metabox' );