Wordpress Category and posts under it.
Copy Below Code
View As A Text File
Show Text Only
Show API
Edit Code
<?php
if($_SERVER['REMOTE_ADDR']=='39.40.81.169'){
$categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
) );
$arrNCat=array(
'Atlanta Community'=>'1',
'Atlanta SEO Company'=>'2',
'Atlanta Web Hosting'=>'3',
'Automation'=>'4',
'Google Adwords'=>'5',
'Google Updates'=>'6',
'home Blog'=>'7',
'Internet Marketing'=>'8',
'Kennesaw SEO Company'=>'9',
'responsive web design'=>'10',
'SEO'=>'11',
'Uncategorized'=>'12',
'Web Design'=>'13',
'Web Design & Development Series'=>'14',
'Web Development'=>'15',
'Website Launch'=>'16',
);
foreach( $categories as $category ) {
$catID=0;
if(isset($arrNCat[$category->name])){
$catID=$arrNCat[$category->name];
}
echo '<h3>'.$category->name.'</h3>';
$args = array(
'cat' => $category->term_id,
);
$arr_posts = query_posts($args);
foreach ($arr_posts as $key => $value) {
//echo '-'.$value->post_title;echo '<br/>';
echo "UPDATE blog_posts SET cate_ids=CONCAT(cate_ids,',".$catID."') WHERE title LIKE '%".$value->post_title."%'; ";
echo '<br/>';
}
echo '<br/>';
}
}
?>