This file contains hidden or 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
// Detect url | |
if (!function_exists('parse_links')) { | |
function parse_links($str) { | |
// The Regular Expression filter | |
$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?|[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; | |
// Check if there is a url in the text | |
if(preg_match($reg_exUrl, $str, $url)) { | |
// make the urls hyper links | |
return preg_replace($reg_exUrl, '<a href="'.$url[0].'" rel="nofollow">'.$url[0].'</a>', $str); | |
} else { |
This file contains hidden or 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
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" role="form" id="login-customer"> | |
<div class="form-group"> | |
<label for="usr">Username</label> | |
<input type="text" name="username" class="form-control" id="usr"> | |
</div> | |
<div class="form-group"> | |
<label for="pwd">Password</label> | |
<input type="password" name="password" class="form-control" id="pwd"> | |
</div> | |
<div class="form-group"> |
This file contains hidden or 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
#wpadminbar { | |
backface-visibility: hidden; | |
} |
This file contains hidden or 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
global $wpdb; | |
/* -- Preparing your query -- */ | |
$query = "SELECT wp_posts.* FROM wp_posts | |
LEFT JOIN wp_postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '_thumbnail_id' ) | |
WHERE $wpdb->posts.post_type = 'photo' AND ( $wpdb->posts.post_status = 'publish' ) AND ( $wpdb->postmeta.post_id IS NULL )"; | |
// $wpdb->posts.post_type = 'photo' -------> custom post type |
This file contains hidden or 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
$taxonomy = 'source'; | |
$terms = get_the_terms( $post->ID, $taxonomy ); | |
if ( $terms ) { | |
foreach($terms as $term) { | |
$term_link = get_term_link( $term ); | |
} | |
} | |
<a href="'. $term_link .'">This is link</a> |
This file contains hidden or 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
<select name="txtkd_unit"> | |
<option value='0'> pilih unit </option> | |
<?php | |
$tampil=mysql_query("select * from unit"); | |
while ($r=mysql_fetch_array($tampil)){ | |
echo "<option value='{$r['kd_unit']}'".($hsl['kd_unit']==$r['kd_unit']?" selected":"").">{$r['nama_unit']}</option>"; | |
} | |
?> | |
</select> |
This file contains hidden or 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
<?php | |
// 1. | |
$text = '#ccc#ddd#fff'; // output awal | |
$data = str_replace ("#", ",#", $text); | |
$str = trim($data,','); | |
echo $str; | |
echo '<br>'; | |
// 2. |
This file contains hidden or 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
<?php | |
if(isset( $_FILES["gambar"] ) ){ | |
//Ulang di setiap file | |
for( $i=0; $i<count($_FILES["gambar"]["name"] ); $i++ ) { | |
//Deteksi temporari path $tmpFilePath = $_FILES["gambar"]['tmp_name'][$i]; | |
//Cek apakah file yang diupload lebih dari satu | |
if ( $tmpFilePath != "" ) { | |
//Set path/folder baru untuk tempat upload | |
$newFilePath = "files/" . $_FILES["gambar"]["name"][$i]; | |
//Upload file dari temporari path ke folder baru |
This file contains hidden or 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
<?php | |
/** | |
* Search rewrite url -> save this in function.php | |
* | |
* @package WordPress | |
* @subpackage Imagefinder | |
* @since Imagefinder 1.0.0 | |
*/ | |
if ( !function_exists( 'warrior_search_url_rewrite ') ) { | |
function warrior_search_url_rewrite() { |
NewerOlder