Optimize AGC template wordpress

AGC adalah autogenerate content
yakni suatu script otomatis menampilkan artikel berdasarkan keyword yang di inginkan

kita akan mengedit template wordpress untuk di jadikan AGC
edit 404.php

<?php get_header?>

ubah menjadi

<?php ob_start(); ?>
<?php header(“HTTP/1.1 200 OK “); ?>
<?php header(“Status: 200 OK “); ?>
<?php
define(‘BING_API_KEY’, ”);
function pete_curl_get($url, $params)
{
$post_params = array();
foreach ($params as $key => &$val) {
if (is_array($val)) $val = implode(‘,’, $val);
$post_params[] = $key.’=’.urlencode($val);
}
$post_string = implode(‘&’, $post_params);
$fullurl = $url.”?”.$post_string;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_URL, $fullurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, ‘msnbot/1.0 (+http://search.msn.com/msnbot.htm)’);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
function perform_bing_web_search($termstring)
{
$searchurl = ‘http://api.bing.net/json.aspx?&#8217;;
$searchurl .= ‘AppId=’.’xxxxxxxxx’;  //masukkan API ID
$searchurl .= ‘&Query=’.urlencode($termstring);
$searchurl .= ‘&Sources=Web’;
$searchurl .= ‘&Web.Count=10’;
$searchurl .= ‘&Web.Offset=0’;
$searchurl .= ‘&Web.Options=DisableHostCollapsing+DisableQueryAlterations’;
$searchurl .= ‘&JsonType=raw’;
$response = pete_curl_get($searchurl, array());
$responseobject = json_decode($response, true);
if ($responseobject[‘SearchResponse’][‘Web’][‘Total’]==0)
return array();
$allresponseresults = $responseobject[‘SearchResponse’][‘Web’][‘Results’];
$result = array();
foreach ($allresponseresults as $responseresult)
{
$result[] = array(
‘url’ => $responseresult[‘Url’],
‘title’ => $responseresult[‘Title’],
‘abstract’ => $responseresult[‘Description’],
);
}
return $result;
}
if (isset($_REQUEST[‘q’])) {
$termstring = urldecode($_REQUEST[‘q’]);
} else {
$termstring = ”;
}
get_header(); ?>

pada baris ke-28 masukkan API id yang bisa di dapat dari http://www.bing.com/developers

setlah itu cari code seperti ini

<h2><?php _e(‘Error 404 – Not Found’, ‘kubrick’); ?></h2>

ubah menjadi

<h1><?php echo CleanFileNameTitle($title) ?></h1>
<?php
function CleanFileName($result ){
$result = str_replace(‘&#8230’, ”,$result);
$result = str_replace(‘ &#8211’, ”,$result);
$result = str_replace(‘ ? ‘, ‘+’,$result);
$result = str_replace(‘&#8211’, ‘+’,$result);
$result = str_replace(‘&#39’, ”, $result);
$result = str_replace(‘ | ‘, ‘+’, $result);
$result = str_replace(‘ |’, ”, $result);
$result = str_replace(‘| ‘, ”, $result);
$result = str_replace(‘ -‘, ”, $result);
$result = str_replace(‘- ‘, ”, $result);
$result = str_replace(‘-‘, ‘+’, $result);
$result = str_replace(‘ ~’, ”, $result);
$result = str_replace(‘~ ‘, ”, $result);
$result = str_replace(‘~’, ‘+’, $result);
$result = str_replace(‘ : ‘, ‘+’, $result);
$result = str_replace(‘ ?’, ”, $result);
$result = str_replace(‘ ?’, ”, $result);
$result = str_replace(‘<‘, ”, $result);
$result = str_replace(‘>’, ”, $result);
$result = str_replace(‘(‘, ”, $result);
$result = str_replace(‘)’, ”, $result);
$result = str_replace(‘/ ‘, ‘+’, $result);
$result = str_replace(‘ /’, ”, $result);
$result = str_replace(‘& ‘, ”, $result);
$result = str_replace(‘ &#58’, ”, $result);
$result = str_replace(‘&#58 ‘, ”, $result);
$result = str_replace(‘.com’, ‘+com’, $result);
$result = str_replace(‘.info’, ‘+info’, $result);
$result = str_replace(‘.net’, ‘+net’, $result);
$result = str_replace(‘.us’, ‘+us’, $result);
$result = str_replace(‘.org’, ‘+org’, $result);
$result = str_replace(‘.co.id’, ‘+co+id’, $result);
$result = str_replace(‘…’, ”, $result);
$result = str_replace(‘.’, ‘+’, $result);
$result = str_replace(‘<Referat> ‘, ”, $result);
$result = str_replace(‘ </Referat>’, ”, $result);
$result = str_replace(‘&#63’, ”, $result);
$result = str_replace(‘ _’, ”, $result);
$result = str_replace(‘_’, ”, $result);
$result = str_replace(‘Yahoo! Answers’, ”, $result);
$result = str_replace(‘ :: ‘, ‘+’, $result);
$result = trim(strip_tags($result));
$RemoveChars = array( “([\40])” , “([^a-zA-Z0-9+])”, “(-{2,})”);
$ReplaceWith = array(“+”, “”, “-“);
return preg_replace($RemoveChars, $ReplaceWith, $result);
}
?>

<?php
function request_as_words($request) {
$request = htmlspecialchars($request);
$request = str_replace(‘.html’, ‘ ‘, $request);
$request = str_replace(‘.htm’, ‘ ‘, $request);
$request = str_replace(‘.’, ‘ ‘, $request);
$request = str_replace(‘/’, ‘ ‘, $request);
$request = str_replace(‘+’, ‘ ‘, $request);
$request = str_replace(‘-‘, ‘ ‘, $request);
$request_a = explode(‘ ‘, $request);
$request_new = array();
foreach ($request_a as $token) {
$request_new[] = ucwords(trim($token));
}
$request = implode(‘ ‘, $request_new);
return $request;
}
function CleanFileNameTitle($title){
$title = request_as_words($_SERVER[‘REQUEST_URI’]);
$title = str_replace(‘&#8230’, ”, $title);
$title = str_replace(‘ &#8211’, ”, $title);
$title = str_replace(‘&#8216’, ”, $title);
$title = str_replace(‘&#8217’, ”, $title);
$title = str_replace(‘&#39’, ”, $title);
$title = str_replace(‘ &amp’, ”, $title);
$title = str_replace(‘ …’, ”, $title);
$title = str_replace(‘:’, ”, $title);
$title = str_replace(‘ |’, ”, $title);
$title = str_replace(‘;’, ”, $title);
$title = str_replace(‘;’, ”, $title);
$title = str_replace(‘:’, ”, $title);
$title = str_replace(‘(‘, ”, $title);
$title = str_replace(‘)’, ”, $title);
$title = str_replace(‘ ?’, ”, $title);
$title = str_replace(‘ ?’, ”, $title);
$title = str_replace(‘,’, ”, $title);
$title = str_replace(‘ -‘, ”, $title);
$title = str_replace(‘ /’, ”, $title);
$title = str_replace(‘.com’, ‘+com’, $title);
$title = str_replace(‘.net’, ‘+net’, $title);
$title = str_replace(‘.info’, ‘+info’, $title);
$title = str_replace(‘.org’, ‘+org’, $title);
$title = str_replace(‘.us’, ‘+us’, $title);
$title = str_replace(‘.co.id’, ‘+co+id’, $title);
$title = trim(strip_tags($title));
return ($title);
}

function CleanFileNameTitle2($result){
$result = str_replace(‘ ‘, ‘-‘, $result);
$result = str_replace(‘&#8230’, ”, $result);
$result = str_replace(‘ &#8211’, ”, $result);
$result = str_replace(‘&#8216’, ”, $result);
$result = str_replace(‘&#8217’, ”, $result);
$result = str_replace(‘&#39’, ”, $result);
$result = str_replace(‘ &amp’, ”, $result);
$result = str_replace(‘ …’, ”, $result);
$result = str_replace(‘:’, ”, $result);
$result = str_replace(‘|’, ”, $result);
$result = str_replace(‘;’, ”, $result);
$result = str_replace(‘;’, ”, $result);
$result = str_replace(‘:’, ”, $result);
$result = str_replace(‘(‘, ”, $result);
$result = str_replace(‘)’, ”, $result);
$result = str_replace(‘ ?’, ”, $result);
$result = str_replace(‘ ?’, ”, $result);
$result = str_replace(‘,’, ”, $result);
$result = str_replace(‘ -‘, ”, $result);
$result = str_replace(‘ /’, ”, $result);
$result = str_replace(‘.com’, ‘-com’, $result);
$result = str_replace(‘.net’, ‘-net’, $result);
$result = str_replace(‘.info’, ‘-info’, $result);
$result = str_replace(‘.org’, ‘-org’, $result);
$result = str_replace(‘.us’, ‘-us’, $result);
$result = str_replace(‘.co.id’, ‘-co-id’, $result);
$result = trim(strip_tags(strtolower($result)));
$RemoveChars = array( “([\40])” , “([^a-zA-Z0-9+])”, “(-{2,})”);
$ReplaceWith = array(“+”, “-“, “-“);
return preg_replace($RemoveChars, $ReplaceWith, $result);
}
?>

<?php $termstring = CleanFileNameTitle($title) ?>

<div id=”sresult”>
<?php
if ($termstring!=”) {
$bingresults = perform_bing_web_search($termstring);
foreach ($bingresults as $result) {
print ‘<div><a href=”‘.$result[‘permalink’].'”>’.$result[‘title’] = preg_replace (‘/&#?[a-z0-9]+;/i’, ‘+’, $result[‘title’]).'</a><br/> ‘;
print ”.$result[‘abstract’].'<br/>’;
print ‘source <a ‘;
print ‘onclick=”window.open ‘;
print ‘(”.$result[‘url’].”)”‘;
print ‘href= #’;
print ‘ rel=”nofollow” style=”color:#777777″>’;
print ”.$result[‘title’] = preg_replace (‘/&#?[a-z0-9]+;/i’, ‘+’, $result[‘title’]).'</a><br/>’;
}
}
?>
</div>
<strong/>random post</strong>
<?php
$rand_posts = get_posts(‘numberposts=5&orderby=rand’); //angka 5 = jumlah postingan yang mau ditampilkan
foreach( $rand_posts as $post ) :
setup_postdata($post);
?>
<div>
<a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a>
<div><?php the_excerpt(); ?> </div>
</div>
<?php endforeach; ?>

 

untuk mengubah title

kita mengedit plugin SEO all in one

edit file  class.php

/**
* @return User-readable nice words for a given request.
*/
function request_as_words($request) {
$request = htmlspecialchars($request);
$request = str_replace(‘.html’, ‘ ‘, $request);
$request = str_replace(‘.htm’, ‘ ‘, $request);
$request = str_replace(‘.’, ‘ ‘, $request);
$request = str_replace(‘/’, ‘ ‘, $request);

diubah menjadi

$request = str_replace(‘+’, ‘ ‘, $request);
$request = str_replace(‘-‘, ‘ ‘, $request);

auto generate content siap di pakai

resiko kehabisan bandwith atau di banned sama hosting tanggung sendiri karena trafik akan sangat besar

selesai

 

 

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: