Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- // Database Connection
- $username = "";
- $password = "";
- $host = "localhost";
- mysql_connect($host,$username,$password);
- // Define slug
- $slug = "headline";
- /* BOF Blog Secition */
- // Check HOME Install for SHARE Tag
- @mysql_select_db('harmonyv_home') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check ABOUT Install for SHARE Tag
- $result = mysql_query("SELECT * FROM wpabout_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wpabout_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wpabout_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check CONTACT Install for SHARE Tag
- $result = mysql_query("SELECT * FROM wpcontact_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wpcontact_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wpcontact_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check MINISTRIES Install for SHARE Tag
- $result = mysql_query("SELECT * FROM wpministries_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wpministries_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wpministries_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check NEWS Install for SHARE Tag
- $result = mysql_query("SELECT * FROM wpnews_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wpnews_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wpnews_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check RESOURCES Install for SHARE Tag
- $result = mysql_query("SELECT * FROM wpresources_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wpresources_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wpresources_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check SERMONS Install for SHARE Tag
- $result = mysql_query("SELECT * FROM wpsermons_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wpsermons_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wpsermons_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check HARMONY BLOG for SHARE Tag
- @mysql_select_db('harmonyv_wrdp6') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check VIDEOS BLOG for SHARE Tag
- @mysql_select_db('harmonyv_wrdp5') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check MISSIONS BLOG for SHARE Tag
- @mysql_select_db('harmonyv_wrdp3') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check QUEST BLOG for SHARE Tag
- @mysql_select_db('harmonyv_wrdp4') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check WOMEN BLOG for SHARE Tag
- @mysql_select_db('harmonyv_wrdp1') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- /* BOF Blog Secition */
- // Check YOUTH BLOG for SHARE Tag
- @mysql_select_db('harmonyv_wrdp2') or die("Unable to select database");
- $result = mysql_query("SELECT * FROM wp_terms WHERE slug='$slug' LIMIT 0,1");
- if (mysql_num_rows($result) > 0) {
- $row = mysql_fetch_array($result);
- $result2 = mysql_query("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id='{$row['term_id']}' ORDER BY object_id DESC LIMIT 0,10");
- if (mysql_num_rows($result2) > 0) {
- while ($row2 = mysql_fetch_array($result2)) {
- $result3 = mysql_query("SELECT * FROM wp_posts WHERE ID='{$row2['object_id']}'");
- $row3 = mysql_fetch_array($result3);
- $date = substr($row3['post_date'], 0, -9);
- $postInfo[] = array(
- 'postDate'=>$date,
- 'postTitle'=>$row3['post_title'],
- 'postUrl'=>$row3['guid']
- );
- }
- } else {
- // Skip, Nothing Here Share
- }
- } else {
- // Skip, Nothing Here to Share
- }
- /* EOF Blog Section */
- // Close MySQL Connection
- mysql_close();
- // Sort Array by Date DESC
- foreach ($postInfo as $key => $row) {
- $dates[$key] = $row['postDate'];
- }
- @array_multisort($dates, SORT_DESC, $postInfo);
- // Set Limit for displayed results
- $limit = 10;
- // Get each result by Date (which is now sorted DESC) and parse results of other Arrays
- foreach ($postInfo as $key => $value) {
- if ($count == $limit) {
- break;
- } else {
- echo "<a href='".$value['postUrl']."'>".$value['postTitle']."</a><br>";
- $count++;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement