Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  #3 fixed widget
  vers
  #2 add posttype and widget
  #2 add posttype for portfolio
  #1 versioning 1.0.1
  start version 1 #1

# Conflicts:
#	dist/assets.json
  • Loading branch information
ikhlas-firlana committed Sep 7, 2016
2 parents 8038ea0 + 604af78 commit 00d1b68
Show file tree
Hide file tree
Showing 21 changed files with 649 additions and 165 deletions.
Binary file added CleanBlog.zip
Binary file not shown.
39 changes: 0 additions & 39 deletions base-home.php

This file was deleted.

3 changes: 2 additions & 1 deletion base.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
<?php
do_action('get_header');
get_template_part('templates/header');
get_template_part('templates/intro');
?>
<div class="wrap container" role="document">
<div class="content row">
<main class="main">
<main>
<?php include Wrapper\template_path(); ?>
</main><!-- /.main -->
</div><!-- /.content -->
Expand Down
3 changes: 3 additions & 0 deletions dist/scripts/jquery-a72f8de744.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,27 @@
require_once $filepath;
}
unset($file, $filepath);

/*========================================================*
* metabox
* ========================================================*/
require_once("parts/add_metabox_intro.php");


/*========================================================*
* post type
* ========================================================*/
require_once("parts/posttype/banner_intro.php");
require_once("parts/posttype/portfolio.php");


/*========================================================*
* Widget
* ========================================================*/
require_once("parts/widget/portfolio_cardview.php");


/*========================================================*
* Shortcode
* ========================================================*/
//require_once("parts/shortcode/bartag.php");
152 changes: 97 additions & 55 deletions home.php
Original file line number Diff line number Diff line change
@@ -1,58 +1,100 @@
<?php
/**
* Template Name: Home
*/
?>
<!-- Main Content -->
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Man must explore, and this is exploration at its greatest
</h2>
<h3 class="post-subtitle">
Problems look mighty small from 150 miles up
</h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on September 24, 2014</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
I believe every human has a finite number of heartbeats. I don't intend to waste any of mine.
</h2>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on September 18, 2014</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Science has not yet mastered prophecy
</h2>
<h3 class="post-subtitle">
We predict too much for the next year and yet far too little for the next ten.
</h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on August 24, 2014</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Failure is not an option
</h2>
<h3 class="post-subtitle">
Many say exploration is part of our destiny, but it’s actually our duty to future generations.
</h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on July 8, 2014</p>
</div>
<hr>
<!-- Pager -->
<ul class="pager">
<li class="next">
<a href="#">Older Posts &rarr;</a>
</li>
</ul>
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<?php
global $post;
$args=array(
'post_type' => 'post',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page'=>-1,
);
$posts = get_posts( $args );
if ($posts) :

foreach ($posts as $post) {

setup_postdata($post);
?>
<div class="post-preview">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<h2 class="post-title">
<?php the_title();?>
</h2>
<h3 class="post-subtitle">
<?php the_content(); ?>
</h3>
</a>
<p class="post-meta">Posted by <a href="#"><?php the_author();?></a> on <?php the_date(); ?></p>
</div>
<hr>
<?php
}

wp_reset_postdata();
endif;
?>
<!--
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Man must explore, and this is exploration at its greatest
</h2>
<h3 class="post-subtitle">
Problems look mighty small from 150 miles up
</h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on September 24, 2014</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
I believe every human has a finite number of heartbeats. I don't intend to waste any of mine.
</h2>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on September 18, 2014</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Science has not yet mastered prophecy
</h2>
<h3 class="post-subtitle">
We predict too much for the next year and yet far too little for the next ten.
</h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on August 24, 2014</p>
</div>
<hr>
<div class="post-preview">
<a href="post.html">
<h2 class="post-title">
Failure is not an option
</h2>
<h3 class="post-subtitle">
Many say exploration is part of our destiny, but it’s actually our duty to future generations.
</h3>
</a>
<p class="post-meta">Posted by <a href="#">Start Bootstrap</a> on July 8, 2014</p>
</div>
<hr>
-->
<!-- Pager
<ul class="pager">
<li class="next">
<a href="?get=all">Older Posts &rarr;</a>
</li>
</ul>
-->
</div>
</div>
</div>
</div>
104 changes: 104 additions & 0 deletions parts/add_metabox_intro.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<?php
/** meta box page attribute We Hiring Dropdown Pages link
======================================================*/
add_action('admin_init', 'cleanblog_themes_meta_box_intro_admin_init');
add_action( 'save_post', 'cleanblog_themes_meta_box_intro_callback_save' );

function cleanblog_themes_meta_box_intro_admin_init() {
add_meta_box( 'cleanblog-meta-box-intro-page-id',
'Intro Banner',
'cleanblog_meta_box_callback',
'page',
'normal',
'high' );
add_meta_box( 'cleanblog-meta-box-intro-post-id',
'Intro Banner',
'cleanblog_meta_box_callback',
'post',
'normal',
'high' );
}

function cleanblog_meta_box_callback(){
//echo "HELLO World!";
global $post;

$values = get_post_custom( $post->ID );
$text_h1 = isset( $values['cleanblog_themes_meta_box_intro_h1_text'] ) ? $values['cleanblog_themes_meta_box_intro_h1_text'] : '';
$text_span = isset( $values['cleanblog_themes_meta_box_intro_span_text'] ) ? $values['cleanblog_themes_meta_box_intro_span_text'] : '';

$banner_select = isset( $values['cleanblog_themes_meta_box_intro_banner_select'] ) ? $values['cleanblog_themes_meta_box_intro_banner_select'] : '';


wp_nonce_field( 'mekar_meta_box_nonce', 'meta_box_nonce' );
?>
<p><strong>Heading</strong></p>
<label class="screen-reader-text" for="cleanblog_themes_meta_box_intro_h1_text">Heading</label>
<input type="text" name="cleanblog_themes_meta_box_intro_h1_text" id="cleanblog_themes_meta_box_intro_h1_text" value="<?php echo $text_h1[0];?>" placeholder="[:en]...[:id]..." style="width: 100%;" />

<p><strong>Sub Heading</strong></p>
<label class="screen-reader-text" for="cleanblog_themes_meta_box_intro_span_text">Sub Heading</label>
<input type="text" name="cleanblog_themes_meta_box_intro_span_text" id="cleanblog_themes_meta_box_intro_span_text" value="<?php echo $text_span[0];?>" placeholder="[:en]...[:id]..." style="width: 100%;"/>
<?php

// run custom type post_type
global $post;

$args = array('post_type' => 'banner','posts_per_page'=>-1);
$posts = get_posts( $args );

if($posts): ?>
<p><strong>Select Banner</strong></p>
<label class="screen-reader-text" for="cleanblog_themes_meta_box_intro_banner_select">Change Banner Image</label>
<select name="cleanblog_themes_meta_box_intro_banner_select" id="cleanblog_themes_meta_box_intro_banner_select">
<?php
if($banner_select[0] and !empty($banner_select[0])):
?>
<option value="<?php echo $banner_select[0]?>"><?php echo get_the_title($banner_select[0]);?></option>
<?php
endif;
?>
<option value="">-- Default -- </option>
<?php
foreach ($posts as $post) {
setup_postdata($post);
?>
<option value="<?php echo $post->ID;?>"><?php the_title();?></option>
<?php
}
?>
</select>
<?php
wp_reset_postdata();
endif;
}

function cleanblog_themes_meta_box_intro_callback_save( $post_id )
{
// Bail if we're doing an auto save
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;

// if our nonce isn't there, or we can't verify it, bail
if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'mekar_meta_box_nonce' ) ) return;

// if our current user can't edit this post, bail
if( !current_user_can( 'edit_post' ) ) return;

// now we can actually save the data
$allowed = array(
'a' => array( // on allow a tags
'href' => array() // and those anchors can only have href attribute
)
);

// Make sure your data is set before trying to save it
if( isset( $_POST['cleanblog_themes_meta_box_intro_h1_text'] ) )
update_post_meta( $post_id, 'cleanblog_themes_meta_box_intro_h1_text', wp_kses( $_POST['cleanblog_themes_meta_box_intro_h1_text'], $allowed ) );

if( isset( $_POST['cleanblog_themes_meta_box_intro_span_text'] ) )
update_post_meta( $post_id, 'cleanblog_themes_meta_box_intro_span_text', esc_attr( $_POST['cleanblog_themes_meta_box_intro_span_text'] ) );

if( isset( $_POST['cleanblog_themes_meta_box_intro_banner_select'] ) )
update_post_meta( $post_id, 'cleanblog_themes_meta_box_intro_banner_select', esc_attr( $_POST['cleanblog_themes_meta_box_intro_banner_select'] ) );

}
Loading

0 comments on commit 00d1b68

Please sign in to comment.