So hab folgendes Probelm diese beiden Link stehen untereinandern.
Warum cat_post?
hier der Thread
1. Ich will aber das die Links nicht unter einandern stehen sonden übereinander!
Deswegen habe ich in die funtion.php dies eingefügt (rot makiert)
Also bei in der funtion.php steht dies
Code
function previous_cat_post($categoryID, $beforeGroup='<ul>', $afterGroup='</ul>', $beforeEach='<li>', $afterEach='</li>', $showtitle=true, $back='«',
$leerzeichen=' '[COLOR=#ff0000]
, $start='<div class="navigation"><div class="alignleft">', $end='</div></div>'[/COLOR]) {
global $wpdb, $post;
// get home url for base of link
$info = get_bloginfo('url');
$info = apply_filters('bloginfo', $info);
$homeurl = convert_chars($info);
// get post id of current post
$currentPostId = $post->ID;
// get post date of current post
$currentPostDate = $post->post_date;
$startGroup = true;
{
// HEAVY LIFTING! Getting the prevous post. Ugh.
$newPostInfo = $wpdb->get_row($wpdb->prepare(
"SELECT * FROM $wpdb->posts
LEFT JOIN $wpdb->term_relationships ON
($wpdb->posts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON
($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->term_taxonomy.taxonomy = 'category'
AND $wpdb->term_taxonomy.term_id = %d
AND $wpdb->posts.post_date < '$currentPostDate'
ORDER BY post_date DESC
LIMIT 1", $categoryID));
if ($newPostInfo)
{
$leaderText = str_replace('%', $currentCat->cat_name, $textForEach);
if ($startGroup)
{
echo $beforeGroup;
$startGroup = false;
}
if ($showtitle)
{
echo $beforeEach.$leaderText."<a href=\"".get_permalink($newPostInfo->ID)."\">"[COLOR=#ff0000].$start[/COLOR].$back.$leerzeichen.stripslashes($newPostInfo->post_title)[COLOR=#ff0000].$end.[/COLOR]"</a>".$afterEach;
}
else
{
echo $beforeEach."<a href=\"".get_permalink($newPostInfo->ID)."\">".$leaderText."</a>".$afterEach;
}
}
}
if (!$startGroup)
{
echo $afterGroup;
}
else
{
}
}
function next_cat_post($categoryID, $beforeGroup='<ul>',
$afterGroup='</ul>', $beforeEach='<li>', $afterEach='</li>', $showtitle=true, $next='»', $leerzeichen=' '
[COLOR=#ff0000], $start='<div class="navigation"><div class="alignleft">', $end='</div></div>'[/COLOR]) {
global $wpdb, $post;
// get home url for base of link
$info = get_bloginfo('url');
$info = apply_filters('bloginfo', $info);
$homeurl = convert_chars($info);
// get post id of current post
$currentPostId = $post->ID;
// get post date of current post
$currentPostDate = $post->post_date;
// get the catagorys this post uses.
$catagoryIds = get_the_category();
$startGroup = true;
{
// HEAVY LIFTING! Getting the next post. Copy and paste of the
// prvious code, but with the sort order and date comparison reversed.
$newPostInfo = $wpdb->get_row($wpdb->prepare(
"SELECT * FROM $wpdb->posts
LEFT JOIN $wpdb->term_relationships ON
($wpdb->posts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON
($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
WHERE $wpdb->posts.post_status = 'publish'
AND $wpdb->term_taxonomy.taxonomy = 'category'
AND $wpdb->term_taxonomy.term_id = %d
AND $wpdb->posts.post_date > '$currentPostDate'
ORDER BY post_date ASC
LIMIT 1", $categoryID));
if ($newPostInfo)
{
$leaderText = str_replace('%', $currentCat->cat_name, $textForEach);
if ($startGroup)
{
echo $beforeGroup;
$startGroup = false;
}
if ($showtitle)
{
echo $beforeEach.$leaderText."<a href=\""[COLOR=#ff0000].$start[/COLOR].get_permalink($newPostInfo->ID)."\">".stripslashes($newPostInfo->post_title).$leerzeichen.$next[COLOR=#ff0000].$end.[/COLOR]"</a>".$afterEach;
}
else
{
echo $beforeEach."<a href=\"".get_permalink($newPostInfo->ID)."\">".$leaderText."</a>".$afterEach;
}
}
}
if (!$startGroup)
{
echo $afterGroup;
}
else
{
}
}
Alles anzeigen
in der single.php
PHP
$special_cats = array('Gothic 1','Risen 1','Simon the Sorcerer'); // die 3 speziellen Kategorien Namen $special_cat = -1;
foreach((get_the_category()) as $category) {
if (in_array($category->cat_name, $special_cats)) {
$special_cat = $category->cat_ID;
}
} if ($special_cat > -1) {
previous_cat_post($special_cat);
next_cat_post($special_cat);
} else {
// User is not in the special categories.
}
Alles anzeigen
es klappt auch halbwegs zumindest beid en artikel wo es einen fürheren und einen späteren gibt!
Aber beim ersten Artikel sieht die Artikel seite so aus
http://puu.sh/DxtW
beim
letzen Artikel
http://puu.sh/Dxu4
und zwischen den Artikeln
http://puu.sh/Dxu8
zwischen den Artikel klappt ja so halbwegs ich hääte es aber gerne wenn der next_cat_post ganz rechts am rand stehen würde....
Weiß wer Rat?