Sunday, December 23, 2012

agc v5-1 implode function

mau buat agc yg baru pake fungsi implode. yg hasile bs muncul : hxxp://aku.com/agc/agc_memakai_implode
=======================================================
$sentence = "agc memakai implode php function"; //Kalimatnya
$value = "3";//Berapa kata yang ingin diambil
$limit_sentence = implode(" ", array_slice(explode(" ", $sentence), 0, $value));
echo $limit_sentence; //Hasilnya
agc memakai implode 
==============================================================

mari berkreasi bersama

ini untuk membuat search base di themes/function.php

=====================================================
/**
 * This, in conjunction with a rule in .htaccess,
 * enables us to have a "pretty" search URL (like example.com/search/hello-world).
 */
add_action('init', 'replace_plus_signs_for_search');
function replace_plus_signs_for_search()
{
 // search=true is set in the .htaccess rewrite rule, to make things simpler.
 if (array_key_exists('search', $_GET) && $_GET['search'] == 'true')
 {
  // if a search term is defined
  if (array_key_exists('s', $_GET))
  {
   // replace dashes with a plus
   $_GET['s'] = str_replace('-', ' ', $_GET['s']);
  }
 }
}
====================================================== 
wpdb hack

======================
<?php
function rh_get_page_id($name)
{
global $wpdb;
// get page id using custom query
$page_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE ( post_name = '".$name."' or post_title = '".$name."' ) and post_status = 'publish' and post_type='page' ");
return $page_id;
}
?>
======================


salam agc mania