forked from tareq1988/wp-generators
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
238 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,36 @@ | ||
<footer class="footer"> | ||
<div class="container"> | ||
<div class="row"> | ||
<p>Made by <a href="https://twitter.com/tareq_cse">@tareq_cse</a></p> | ||
<!-- | ||
<div class="social-links"> | ||
<ul class="social-buttons"> | ||
<li> | ||
<iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=tareq1988&repo=wp-generators&type=watch&count=true" width="100" height="20" title="Star on GitHub"></iframe> | ||
</li> | ||
<li> | ||
<iframe class="github-btn" src="https://ghbtns.com/github-btn.html?user=tareq1988&repo=wp-generators&type=fork&count=true" width="102" height="20" title="Fork on GitHub"></iframe> | ||
</li> | ||
<li class="follow-btn"> | ||
<a href="https://twitter.com/tareq_cse" class="twitter-follow-button" data-show-count="false">Follow @tareq_cse</a> | ||
</li> | ||
<li class="tweet-btn"> | ||
<a href="https://twitter.com/share" class="twitter-share-button" data-text="Checkout this awesome #WordPress Code Generator, its pretty cool!" data-via="tareq_cse">Tweet</a> | ||
</li> | ||
</ul> | ||
</div> | ||
--> | ||
<p>Made by <a href="http://tareq.wedevs.com">Tareq Hasan</a></p> | ||
</div> | ||
</div> | ||
</footer> | ||
|
||
<script src="assets/js/jquery.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="assets/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script> | ||
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script> | ||
<script src="assets/js/script.js" type="text/javascript" charset="utf-8"></script> | ||
<!-- | ||
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> | ||
--> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* Insert a new leave policy | ||
* | ||
* @param array $args | ||
*/ | ||
function prefix_insert_%singular_name%( $args = array() ) { | ||
global $wpdb; | ||
|
||
$defaults = array( | ||
'id' => null, | ||
'date' => current_time( 'mysql' ) | ||
); | ||
|
||
$args = wp_parse_args( $args, $defaults ); | ||
$table_name = $wpdb->prefix . '%mysql_table%'; | ||
|
||
// some basic validation | ||
if ( empty( $args['name'] ) ) { | ||
return new WP_Error( 'no-name', __( 'No name provided.', 'wp-error' ) ); | ||
} | ||
|
||
if ( ! intval( $args['value'] ) ) { | ||
return new WP_Error( 'no-value', __( 'No duration provided.', 'wp-error' ) ); | ||
} | ||
|
||
// remove row id to determine if new or update | ||
$row_id = (int) $args['id']; | ||
unset( $args['id'] ); | ||
|
||
if ( ! $row_id ) { | ||
|
||
// insert a new | ||
if ( $wpdb->insert( $table_name, $args ) ) { | ||
return $wpdb->insert_id; | ||
} | ||
|
||
} else { | ||
|
||
// do update method here | ||
if ( $wpdb->update( $table_name, $args, array( 'id' => $row_id ) ) ) { | ||
return $row_id; | ||
} | ||
} | ||
|
||
return false; | ||
} |
Oops, something went wrong.