//echo ‘Server date and time is: ‘;
//echo date(‘l, F j, Y \a\t G:i:s’);
[/insert_php]
[insert_php]
global $wpdb;
$wpdb->hide_errors();
$wpdb->show_errors();
$fivesdrafts = $wpdb->get_results(
”
SELECT
A.ID
, A.guid
, A.post_title
, A.post_type
, A.post_status
, DATE_FORMAT(A.post_date,’%e-%b-%Y’) as post_date
, B.taxonomy
, B.description
, B.name
, B.slug
, B.term_group
, C.meta_value
FROM
$wpdb->posts A
LEFT OUTER JOIN (
SELECT
$wpdb->term_relationships.object_id
, $wpdb->term_taxonomy.taxonomy
, $wpdb->term_taxonomy.description
, $wpdb->terms.name
, $wpdb->terms.slug
, $wpdb->terms.term_group
FROM
$wpdb->term_relationships
, $wpdb->term_taxonomy
, $wpdb->terms
WHERE
$wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
AND $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
AND $wpdb->term_taxonomy.taxonomy = ‘category’
) B
ON A.id = B.object_id
LEFT OUTER JOIN (
SELECT
$wpdb->postmeta.post_id
, $wpdb->postmeta.meta_value
FROM
$wpdb->postmeta
WHERE
$wpdb->postmeta.meta_key = ‘الصحيفة’
) C
ON A.id = C.post_id
WHERE
A.post_status = ‘publish’
AND A.post_type = ‘post’
ORDER BY
B.name
, A.post_date DESC
”
);
$previous_category = NULL;
$alternate_row = 0;
$number_of_records = $wpdb->num_rows;
//echo ‘count: ‘ . $wpdb->num_rows;
$months = array(
“Jan” => “يناير”,
“Feb” => “فبراير”,
“Mar” => “مارس”,
“Apr” => “أبريل”,
“May” => “مايو”,
“Jun” => “يونيو”,
“Jul” => “يوليو”,
“Aug” => “أغسطس”,
“Sep” => “سبتمبر”,
“Oct” => “أكتوبر”,
“Nov” => “نوفمبر”,
“Dec” => “ديسمبر”
);
foreach ( $fivesdrafts as $fivesdraft )
{
//Or is_null($previous_category)
if ( $previous_category == $fivesdraft->name) {
//echo “Same Category as Previous”;
if ( $alternate_row == 0 ) {
$alternate_row = 1;
echo ‘
} else {
$alternate_row = 0;
echo ‘
}
echo ‘
‘;
echo ‘
‘;
echo ‘
‘;
echo ‘
‘;
echo ‘
‘;
echo ‘
‘;
echo ‘
echo ‘
‘;
echo ‘