Cibama
if($_SERVER['REQUEST_URI']=='/cibama-blog/'){ ?>
Tutti
} else { ?>
Tutti
} ?>
$categories = $mydb->get_results(
"SELECT DISTINCT name, parent, slug
FROM wf_terms
JOIN wf_term_taxonomy ON wf_term_taxonomy.term_id = wf_terms.term_id
WHERE wf_term_taxonomy.taxonomy = 'category'
AND wf_terms.name != 'tutti'
AND wf_term_taxonomy.count > 0
ORDER BY wf_terms.name ASC"
);
//print_r($categories);
foreach ( $categories as $category ) {
$category_term_id = $category->term_id;
$category_parent = $category->parent;
$category_name = $category->name;
$category_slug = $category->slug;
if($category_parent==0){
$category_parent_slug = $category->slug;
}
?>
} else { ?>
} ?>
tutti
}?>
if($slug){
$category_blog_events = $mydb->get_results(
"SELECT term_id, name
FROM wf_terms
WHERE wf_terms.name = '$slug'"
);
//echo $titlemenu;
foreach ( $category_blog_events as $category_blog_event )
{
$category_blog_event_name = $category_blog_event->name;
$category_blog_event_term_id = $category_blog_event->term_id;
}
if($category_blog_event_term_id){
$rows = $mydb->get_results(
/*"SELECT p.*, meta1.meta_value
FROM wf_posts p
LEFT JOIN
wf_postmeta meta1
ON (
meta1.post_id = p.ID
AND meta1.meta_value IS NOT NULL
AND meta1.meta_key = '_thumbnail_id'
)
JOIN wf_term_relationships ON wf_term_relationships.object_id = wf_posts.ID
WHERE wf_term_relationships.term_taxonomy_id = '$category_blog_event_term_id'
WHERE p.post_type = 'post'
AND p.post_status = 'publish'
ORDER BY p.ID DESC"*/
"SELECT *
FROM wf_posts
JOIN wf_term_relationships ON wf_term_relationships.object_id = wf_posts.ID
JOIN wf_postmeta ON (wf_postmeta.post_id = wf_posts.ID AND wf_postmeta.meta_key = '_thumbnail_id')
WHERE wf_term_relationships.term_taxonomy_id = '$category_blog_event_term_id'
ORDER BY wf_posts.ID DESC"
);
} else {
$rows = $mydb->get_results( "SELECT p.*, meta1.meta_value
FROM wf_posts p
LEFT JOIN
wf_postmeta meta1
ON (
meta1.post_id = p.ID
AND meta1.meta_value IS NOT NULL
AND meta1.meta_key = '_thumbnail_id'
)
WHERE p.post_type = 'post'
AND p.post_status = 'publish'
ORDER BY p.ID DESC");
}
} else {
$rows = $mydb->get_results( "SELECT p.*, meta1.meta_value
FROM wf_posts p
LEFT JOIN
wf_postmeta meta1
ON (
meta1.post_id = p.ID
AND meta1.meta_value IS NOT NULL
AND meta1.meta_key = '_thumbnail_id'
)
WHERE p.post_type = 'post'
AND p.post_status = 'publish'
ORDER BY p.ID DESC");
}
$wp_query->posts = $rows;
$wp_query->max_num_pages = count($rows)/6;
$n_page_max=round($wp_query->max_num_pages, 0)+1;
$mul = 0;
?>
$img = $mydb->get_results("SELECT *
FROM wf_posts
WHERE post_type = 'attachment'
AND ID = '".$rows[$mul]->meta_value."'
ORDER BY ID DESC");
//print_r($img[0]->guid);
$array_img[$mul] = $img[0]->guid;
$array_link[$mul] = get_bloginfo( 'url' ).'/articolo/?id='.get_slug();
$array_title[$mul] = get_the_title();
$array_excerpt[$mul] = get_the_excerpt();
?>
$img = $mydb->get_results("SELECT *
FROM wf_posts
WHERE post_type = 'attachment'
AND ID = '".$rows[$mul]->meta_value."'
ORDER BY ID DESC");
//print_r($img[0]->guid);
$array_img[$mul] = $img[0]->guid;
$array_link[$mul] = get_bloginfo( 'url' ).'/articolo/?id='.get_slug();
$array_title[$mul] = get_the_title();
$array_excerpt[$mul] = get_the_excerpt();
?>
$img = $mydb->get_results("SELECT *
FROM wf_posts
WHERE post_type = 'attachment'
AND ID = '".$rows[$mul]->meta_value."'
ORDER BY ID DESC");
//print_r($img[0]->guid);
$array_img[$mul] = $img[0]->guid;
$array_link[$mul] = get_bloginfo( 'url' ).'/articolo/?id='.get_slug();
$array_title[$mul] = get_the_title();
$array_excerpt[$mul] = get_the_excerpt();
?>
$img = $mydb->get_results("SELECT *
FROM wf_posts
WHERE post_type = 'attachment'
AND ID = '".$rows[$mul]->meta_value."'
ORDER BY ID DESC");
//print_r($img[0]->guid);
$array_img[$mul] = $img[0]->guid;
$array_link[$mul] = get_bloginfo( 'url' ).'/articolo/?id='.get_slug();
$array_title[$mul] = get_the_title();
$array_excerpt[$mul] = get_the_excerpt();
?>
$img = $mydb->get_results("SELECT *
FROM wf_posts
WHERE post_type = 'attachment'
AND ID = '".$rows[$mul]->meta_value."'
ORDER BY ID DESC");
//print_r($img[0]->guid);
$array_img[$mul] = $img[0]->guid;
$array_link[$mul] = get_bloginfo( 'url' ).'/articolo/?id='.get_slug();
$array_title[$mul] = get_the_title();
$array_excerpt[$mul] = get_the_excerpt();
?>
$img = $mydb->get_results("SELECT *
FROM wf_posts
WHERE post_type = 'attachment'
AND ID = '".$rows[$mul]->meta_value."'
ORDER BY ID DESC");
//print_r($img[0]->guid);
$array_img[$mul] = $img[0]->guid;
$array_link[$mul] = get_bloginfo( 'url' ).'/articolo/?id='.get_slug();
$array_title[$mul] = get_the_title();
$array_excerpt[$mul] = get_the_excerpt();
?>
$n_title = count($array_title);?>