You are on page 1of 18

<?

php
/**
* portknow functions and definitions.
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package portknow
*/
if ( ! function_exists( 'portknow_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function portknow_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on portknow, use a find and replace
* to change 'portknow' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'portknow', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded <title> tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-postthumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'portknow' ),
) );
/*
* Switch default core markup for search form, comment form, and comments

* to output valid HTML5.


*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background',
apply_filters( 'portknow_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'portknow_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function portknow_content_width() {
$GLOBALS['content_width'] = apply_filters( 'portknow_content_width', 640 );
}
add_action( 'after_setup_theme', 'portknow_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function portknow_widgets_init() {
register_sidebar( array(
'name'
=> esc_html__( 'Sidebar', 'portknow' ),

'id'
=> 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'portknow' ),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'portknow_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function portknow_scripts() {
wp_enqueue_style( 'portknow-style', get_stylesheet_uri() );
wp_enqueue_script( 'portknow-navigation', get_template_directory_uri() . '/js/navigation.js',
array(), '20151215', true );
wp_enqueue_script( 'portknow-js', get_template_directory_uri() . '/js/portknow.js',
array('jquery'));
wp_enqueue_script( 'portknow-skip-link-focus-fix', get_template_directory_uri() . '/js/skiplink-focus-fix.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'portknow_scripts' );
// ---------------- TAMBAHAN -----------------//Register New Menu Navigation
add_action( 'init', 'my_custom_menus' );
function my_custom_menus() {
register_nav_menus(
array(
'primary-menu' => __( 'Primary Menu' ),
'secondary-menu' => __( 'Secondary Menu' )
)
);
}
// menghilkangkan nama category pada page category
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {

$title = single_tag_title( '', false );


} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
return $title;
});
// login redirect
/**
* Redirect user after successful login.
*
* @param string $redirect_to URL to redirect to.
* @param string $request URL the user is coming from.
* @param object $user Logged user's data.
* @return string
*/
function my_login_redirect( $redirect_to, $request, $user ) {
//is there a user to check?
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
//check for admins
if ( in_array( 'administrator', $user->roles ) ) {
// redirect them to the default place
return $redirect_to;
} else {
return home_url();
}
} else {
return $redirect_to;
}
}
add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
// ganti logo
function my_login_logo() { ?>
<style type="text/css">
#login h1 a, .login h1 a {
background-image: url(http://bacapikiran.com/wp-content/uploads/2016/07/croppediconbp.png);
padding-bottom: 30px;
}
</style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

function my_login_logo_url() {
return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );
function my_login_logo_url_title() {
return 'Bacapikiran, Merekah kedalam pikiran';
}
add_filter( 'login_headertitle', 'my_login_logo_url_title' );
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
add_filter('wpseo_enable_xml_sitemap_transient_caching', '__return_false');
// ---------------- END TAMBAHAN-----------------/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
<?php
/**
* The header for our theme.
*
* This is the template that displays all of the <head> section and everything up until <div
id="content">

*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @package portknow
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, userscalable=no"/>
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/fontawesome.min.css">
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43975084-2', 'auto');
ga('send', 'pageview');
</script>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="site">
<a class="skip-link screen-reader-text" href="#main"><?php esc_html_e( 'Skip to content',
'portknow' ); ?></a>
<header id="masthead" class="site-header" role="banner">
<!-- <button id="ss" style="position: fixed; bottom: 100px;">as</button> -->
<div id="bg-top-head"><div class="top-head">
<h1 hidden class="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?>
</a>
</h1>
<div id="post-navigation" class="navigation-class nav-first"
role="navigation">
<i class="material-icons ico-menu menu-mob-top"
onclick="openNav()">menu</i>
<span>

<span id="nav-first-title">Menu</span>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id'
=> 'primary-menu' ) ); ?>
</span>
</div><!-- #site-navigation -->
<div class="site-branding">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
<img id="ass" class="aligncenter" src="<?php
bloginfo('template_url'); ?>/img/bacapikiranputih.svg" />
</a>
</div><!-- .site-branding -->
<div class="top-right">
<div id="top-search" class="">
<?php get_search_form(); ?>
<i class="material-icons close-top-ico">close</i>
</div>
<div style="position: relative;height: 100%;">
<div id=top-ico>
<i class="material-icons search-top-ico">search</i>
<!-- <i class="material-icons">person</i> -->
<?php
if (is_user_logged_in ()) {
$cu_user = wp_get_current_user();
// $cu_id = $cu_user->ID;
// echo get_avatar($cu_id,'30');
echo '<a href="';
echo
get_permalink( get_page_by_path( 'edit-user' ) );
echo '" class="hover_op usr">'.$cu_user>display_name.'</a>';
?><a href="<?php echo
wp_logout_url( home_url() ); ?>" class="hover_op lgt" >Logout</a>
<?php } else {
?>
<a href="#openModal"><button
class="lgn">login</button></a><a href="<?php echo get_permalink( get_page_by_path( 'register' )
); ?>"><button class="rgt">signup</button></a>
<?php } ?>
</div>
</div>
</div>
</div></div>
<div class="bot-head">
<?php if (is_front_page()) : ?>
<div class="as">

<?php
$description = get_bloginfo( 'description', 'display' );
if ( $description || is_customize_preview() ) : ?>
<p class="site-description"><?php echo $description; ?
></p>
</div>
<?php endif; endif;?>
</div>
<div class="nav-head">
<div id="site-navigation" class="navigation-class nav-second">
<?php wp_nav_menu (array('theme_location' => 'secondarymenu','menu_class' => 'nav'));?>
</div>
<div class="mob-menu">
<i class="material-icons ico-menu" onclick="openNav()">menu</i>
<div class="search-bar"><?php get_search_form(); ?></div>
</div>
</div>
</header><!-- #masthead -->
<div id="content" class="site-content">
<!-- Side nav -->
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">&times;</a>
<div id="sideavatar">
<?php
if (is_user_logged_in ()) {
$cu_user = wp_get_current_user();
$cu_id = $cu_user->ID;
echo get_avatar($cu_id,'80');
echo '<a href="';
echo get_permalink( get_page_by_path( 'edit-user' ) );
echo '" class="hover_op usr">'.$cu_user->display_name.'</a>';
?><a href="<?php echo wp_logout_url( home_url() ); ?>" class="hover_op
lgt" >Logout</a>
<?php }
?>
</div>
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'primary-menu' ) ); ?>
</div>

<!-- LOGIN FORM POPUP -->


<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h2>Silahkan Login</h2>
<?php echo do_shortcode('[wppb-login]'); ?>
</div>
</div>

#wppb-edit-user {
padding: 10px 4px;
border: none;
border-radius: 4px;
background-color: rgba(26, 0, 70, 0.59);
color: #c3c3c3 !important;
}
label[for="edit_user"]{
font: 500 22px 'Roboto';
}
.wppb-user-forms {
ul {
margin :0px;
padding :0px;
.wppb-form-field {
list-style : none;
width: 70%;
@include displayflex (nowrap);
border-bottom:1px dashed rgba(26, 0, 70, 0.56);
padding:10px;
margin : 0px auto;
font: 300 18px 'Roboto' !important;
h4 {
width: 100%;
text-align: center;
font : 500 22px 'Roboto';
}
label {
@include flex (1);
padding-right:20px;
text-align: right;
.wppb-required {
color:red !important;
}
}
input , textarea, select {
@include flex (1);
padding : 10px 4px;

border : none;
border-radius :4px;
background-color: rgba(26, 0, 70, 0.59);
color :#c3c3c3 !important;
}
input[disabled]{
background-color: rgba(26, 0, 70, 0.2);
}
}
}
.form-submit {
text-align: center;
}
}
.alert, .wppb-error {
text-align :center;
font : 300 22px 'Roboto';
color :red;
}
#loginform {
p{
width: 70%;
min-width: 320px;
@include displayflex (nowrap);
border-bottom:1px dashed rgba(26, 0, 70, 0.56);
padding:10px;
margin : 0px auto;
font: 300 18px 'Roboto' !important;
label {
@include flex (1);
padding-right:20px;
text-align: right;
.wppb-required {
color:red !important;
}
}
#user_pass, #user_login {
@include flex (1);
padding : 10px 4px;
border : none;
border-radius :4px;
background-color: rgba(26, 0, 70, 0.59);
color :#c3c3c3 !important;
}

#wppb-submit {
margin:0 auto;
}
}
}
.login-register-lost-password {text-align:center;}
.flickity-enabled {
position: relative;
}
.flickity-enabled:focus { outline: none; }
.flickity-viewport {
overflow: hidden;
position: relative;
height: 100%;
}
.flickity-slider {
position: absolute;
width: 100%;
height: 100%;
}
/* draggable */
.flickity-enabled.is-draggable {
-webkit-tap-highlight-color: transparent;
tap-highlight-color: transparent;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.flickity-enabled.is-draggable .flickity-viewport {
cursor: move;
cursor: -webkit-grab;
cursor: grab;
}
.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down {
cursor: -webkit-grabbing;
cursor: grabbing;
}
/* ---- previous/next buttons ---- */
.flickity-prev-next-button {

position: absolute;
top: 50%;
width: 44px;
height: 44px;
border: none;
border-radius: 50%;
background: white;
background: hsla(0, 0%, 100%, 0.75);
cursor: pointer;
/* vertically center */
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.flickity-prev-next-button:hover { background: white; }
.flickity-prev-next-button:focus {
outline: none;
box-shadow: 0 0 0 5px #09F;
}
.flickity-prev-next-button:active {
filter: alpha(opacity=60); /* IE8 */
opacity: 0.6;
}
.flickity-prev-next-button.previous { left: 10px; }
.flickity-prev-next-button.next { right: 10px; }
/* right to left */
.flickity-rtl .flickity-prev-next-button.previous {
left: auto;
right: 10px;
}
.flickity-rtl .flickity-prev-next-button.next {
right: auto;
left: 10px;
}
.flickity-prev-next-button:disabled {
filter: alpha(opacity=30); /* IE8 */
opacity: 0.3;
cursor: auto;
}
.flickity-prev-next-button svg {
position: absolute;
left: 20%;
top: 20%;
width: 60%;
height: 60%;
}

.flickity-prev-next-button .arrow {
fill: #333;
}
/* color & size if no SVG - IE8 and Android 2.3 */
.flickity-prev-next-button.no-svg {
color: #333;
font-size: 26px;
}
/* ---- page dots ---- */
.flickity-page-dots {
position: absolute;
width: 100%;
bottom: -25px;
padding: 0;
margin: 0;
list-style: none;
text-align: center;
line-height: 1;
}
.flickity-rtl .flickity-page-dots { direction: rtl; }
.flickity-page-dots .dot {
display: inline-block;
width: 10px;
height: 10px;
margin: 0 8px;
background: #333;
border-radius: 50%;
filter: alpha(opacity=25); /* IE8 */
opacity: 0.25;
cursor: pointer;
}
.flickity-page-dots .dot.is-selected {
filter: alpha(opacity=100); /* IE8 */
opacity: 1;
}
/* position dots up a bit */
.flickity-page-dots {
bottom: -22px;
}
/* dots are lines */
.flickity-page-dots .dot {
height: 4px;
width: 40px;
margin: 0;

border-radius: 0;
}

.carousel-cell {
position:relative;
width: 299px;
height: 200px;
margin:0 2%;
border:1px solid black;
overflow: hidden;
border-radius:4px;
a{
text-align: right;
text-decoration: none;
width: 100%;
}
.car-title {
position: absolute;
z-index: 1;
bottom: 0;
width: 100%;
background-color: rgba(0, 0, 0, 0.76);
color: white;
padding:0 10px;
}
img{
width: 100%;
height: auto;
min-height: 100%;
position:absolute;
}
.cat-cat {
position:absolute;
top:0;
right:0;
font-size: 16px;
border-top-right-radius:4px;
}
}
.front-cat {
position:relative;
height: 950px;
.front-cat-desc {
margin: 10px 5%;
font-size: 23px;
color: #a7a1a1;
text-indent: 70px;
}
.front-cat-child {

margin:50px 2px;
text-align:center;
a{
font:300 18px/55px 'Roboto';
color: #a7a1a1;
padding: 10px;
margin:10px 1% ;
border:1px solid black;
transition: all 0.7s;
&:hover {
background-color:black;
opacity: 0.4;
}
}
}
}
@mixin rotate ($val){
-ms-transform: rotate($val);
-webkit-transform: rotate($val);
transform: rotate($val);
}
.aa {
position: absolute;
top: -118px;
height: 120px;
width: 100%;
}
$break-large : 550px;
#misteri-box {
background-color:#1a1a6f;
path {
opacity: 1;
fill:#1a1a6f;
}
.front-cat-title {position: absolute;top: -100px;}
@media screen and (min-width: $break-large) {
.front-cat-title {
height: 197px;
position: absolute;
top: -254px;
right: 1px;
@include rotate(3deg);
}
}
}
#sains-box {
background-color:#6c0209;
path {
opacity: 1;

fill:#6c0209;
}
@media screen and (min-width: $break-large) {
.front-cat-title {
height: 130px;
position: absolute;
top: -132px;
@include rotate(-4deg);
}
}
.front-cat-desc {
padding-top: 20px;
}
}
#unik-box {
background-color:#047c8b;
path {
opacity: 1;
fill:#047c8b;
}
@media screen and (min-width: $break-large) {
.front-cat-title {
margin:0;
height: 130px;
position: relative;
top: -132px;
@include rotate(-4deg);
}
.front-cat-desc p {
margin-top: -100px;
}
}
}
#trick-box {
background-color:#6b5c07;
path {
opacity: 1;
fill:#6b5c07;
}
.front-cat-title {position: absolute;top: -100px;}
@media screen and (min-width: $break-large) {
.front-cat-title {
height: 143px;
position: absolute;
top: -198px;
right: 1px;
@include rotate(3deg);
}
}
}
.front-cat-title {

margin: 0 auto;
display: block;
height: 100px;
}
.main1 {
margin-bottom: -10px !important;
}

#well {
font: 700 40px/46px 'Roboto';
text-align: center;
margin: 100px 0;
}
.well-box {
width: 300px;
height: auto;
margin:20px auto;
img {
width: 300px;
}
.br2 {
font: 500 44px/34px 'Roboto';
color: #f46a1a;
position: relative;
top: -106px;
left: 20px;
}
.br1 {
font: 700 46px/34px 'Roboto';
color: #ff926e;
position: relative;
top: -103px;
left: 20px;
}
}
.front-quote {
position: relative;
margin: 50px 0 200px;
blockquote p {
font-size: 23px;
margin: 0;
border-top: 4px dashed white;
border-bottom:0;
padding: 20px 0 0;
color:#383838;
}

p{
font-size: 18px;
margin:0 1.5em;
padding-bottom: 20px;
border-bottom: 4px dashed white;
}
}