Super, zumindest sehe ich jetzt meine sidebar, was ich im backend einstelle. Es klappt. Jetzt nur noch die function bearbeiten, da warte ich lieber auf deine Antwort.
Beiträge von Resul
-
-
Also, kannste mir den Ablauf mit der function.php erklären. Ich weiß ich nerve, aber danach kriege ich den rest schon hin glaube ich.
Ich lass in der Function.php nur deinen Code drin, also in PHP-Tags denke ich mal. Der rest kommt in eine sepparate Datei? Ist der Name Relevant? In welches Verzeichnis, wo der function auch drin ist?
-
Kann ich die Datei so benennen wie ich will?
-
Aaaah, ich glaub ich habe gesehen was du meinst mit dem Plugin im function.php. Ok habs gelöscht, aber ich komme immernoch nicht weiter mit meiner Sidebar:|
-
Ok, sorry, bin wie gesagt sehr neu hier.
Also ich habe deinen Code so eingegeben folgender fehler taucht auf:
Schau es dir auf meiner Seite an: Home
Sidebar
PHP
Alles anzeigen<div class="SR"><div class="SRL"> dynamic_sidebar( 'sidebar-1' ); <div class="Search"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <input type="text" name="s" class="keyword" /> <div id="buttonsearch"><input name="submit" type="image" class="search" title="Search" src="<?php bloginfo('template_url'); ?>/images/ButtonTransparent.png" alt="Search" /> </div> </form> </div> <div class="Syn"><div class="SynTop"></div> <ul> <li><a href="<?php bloginfo('rss2_url'); ?>">News</a> (RSS)</li> <li><a href="<?php bloginfo('comments_rss2_url'); ?>">Kommentare</a> (RSS)</li> </ul> </div> <!-- Start Flickr Photostream --> <?php if (function_exists('get_flickrrss')) { ?> <div class="Flickr"> <h3>PhotoStream</h3> <ul> <?php get_flickrrss(); ?> </ul> </div> <?php } ?> <!-- End Flickr Photostream --> <div class="Categ"> <h3>Categories</h3> <ul> <?php wp_list_cats(); ?> </ul> </div> <!-- Start Recent Comments --> <?php if (function_exists('mdv_recent_comments')) { ?> <div class="LatestCom"> <h3>Letzte Kommentare</h3> <ul> <?php mdv_recent_comments('10'); ?> </ul> </div> <?php } ?> <!-- End Recent Comments --> </div><div class="SRR"> <h3>Links</h3> <ul><?php get_links('-1', '<li>', '</li>', '', FALSE, 'id', FALSE, FALSE, -1, FALSE); ?> </ul> <br /> <h3>Archiv</h3> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <br /> <h3>Meta</h3> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <?php wp_meta(); ?> </ul> </div></div>Was muss ich denn jetzt genau in der Function wegmachen, wenn du sagst Plugin hat da nichts zu suchen, kann ich leider nicht viel mit anfangen. Wie gesagt, ich kann zwar einige sachen ausführen, laden und einigermaßen lesen, aber von PHP verstehe ich gleich Null.
Hier nochmal meine Function.php
PHP
Alles anzeigen<?php /* Plugin Name: Recent Comments Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/ Description: Retrieves a list of the most recent comments. Version: 1.18 Author: Nick Momrik Author URI: http://mtdewvirus.com/ */ add_action( 'widgets_init', 'resul_sidebar_setup' ); function resul_sidebar_setup() { register_sidebar( array ( 'name' => 'Sidebar 1', 'id' => 'sidebar-1', 'before_widget' => '<div id="sidebar-1">', 'after_widget' => "</div>\n", ) ); } if (function_exists('mdv_recent_comments')) { }else{ function mdv_recent_comments($no_comments = 10, $comment_lenth = 5, $before = '<li class="off" onmouseover=this.className="on"; onmouseout=this.className="off";>', $after = '</li>', $show_pass_post = false, $comment_style = 0) { global $wpdb; $request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') "; if(!$show_pass_post) $request .= "AND post_password ='' "; $request .= "AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT $no_comments"; $comments = $wpdb->get_results($request); $output = ''; if ($comments) { foreach ($comments as $comment) { $comment_author = stripslashes($comment->comment_author); if ($comment_author == "") $comment_author = "anonymous"; $comment_content = strip_tags($comment->comment_content); $comment_content = stripslashes($comment_content); $words=split(" ",$comment_content); $comment_excerpt = join(" ",array_slice($words,0,$comment_lenth)); $permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID; if ($comment_style == 1) { $post_title = stripslashes($comment->post_title); $url = $comment->comment_author_url; if (empty($url)) $output .= $before . $comment_author . ' on ' . $post_title . '.' . $after; else $output .= $before . "<a href='$url' rel='external'>$comment_author</a>" . ' on ' . $post_title . '.' . $after; } else { $output .= $before . '' . $comment_author . ': <a href="' . $permalink; $output .= '" title="View the entire comment by ' . $comment_author.'">' . $comment_excerpt.'</a>' . $after; } } $output = convert_smilies($output); } else { $output .= $before . "None found" . $after; } echo $output; } } ?> -
Ich kopiere dir mal die gesamte function und sidebar hier rein
Sidebar:
<div class="SR"><div class="SRL">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($name_or_number) ) : endif;
?><div class="Search">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="s" class="keyword" />
<div id="buttonsearch"><input name="submit" type="image" class="search" title="Search" src="<?php bloginfo('template_url'); ?>/images/ButtonTransparent.png" alt="Search" />
</div>
</form>
</div>
<div class="Syn"><div class="SynTop"></div>
<ul>
<li><a href="<?php bloginfo('rss2_url'); ?>">News</a> (RSS)</li>
<li><a href="<?php bloginfo('comments_rss2_url'); ?>">Kommentare</a> (RSS)</li>
</ul>
</div>
<!-- Start Flickr Photostream -->
<?php if (function_exists('get_flickrrss')) { ?>
<div class="Flickr">
<h3>PhotoStream</h3>
<ul>
<?php get_flickrrss(); ?>
</ul>
</div>
<?php } ?>
<!-- End Flickr Photostream -->
<div class="Categ">
<h3>Categories</h3>
<ul>
<?php wp_list_cats(); ?>
</ul>
</div>
<!-- Start Recent Comments -->
<?php if (function_exists('mdv_recent_comments')) { ?>
<div class="LatestCom">
<h3>Letzte Kommentare</h3>
<ul>
<?php mdv_recent_comments('10'); ?>
</ul>
</div>
<?php } ?>
<!-- End Recent Comments -->
</div><div class="SRR">
<h3>Links</h3>
<ul><?php get_links('-1', '<li>', '</li>', '', FALSE, 'id', FALSE,
FALSE, -1, FALSE); ?>
</ul>
<br />
<h3>Archiv</h3>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
<br />
<h3>Meta</h3>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>
</div></div>
Function:
<?php
/*
Plugin Name: Recent Comments
Plugin URI: http://mtdewvirus.com/code/wordpress-plugins/
Description: Retrieves a list of the most recent comments.
Version: 1.18
Author: Nick Momrik
Author URI: http://mtdewvirus.com/
*/
add_action( 'widgets_init', 'resul_sidebar_setup' );
function resul_sidebar_setup()
{
register_sidebar(
array (
'name' => 'Sidebar 1',
'id' => 'sidebar-1',
'before_widget' => '<div id="sidebar-1">',
'after_widget' => "</div>\n",
)
);
}if (function_exists('mdv_recent_comments')) {
}else{
function mdv_recent_comments($no_comments = 10, $comment_lenth = 5, $before = '<li class="off" onmouseover=this.className="on"; onmouseout=this.className="off";>', $after = '</li>', $show_pass_post = false, $comment_style = 0) {
global $wpdb;
$request = "SELECT ID, comment_ID, comment_content, comment_author, comment_author_url, post_title FROM $wpdb->comments LEFT JOIN $wpdb->posts ON $wpdb->posts.ID=$wpdb->comments.comment_post_ID WHERE post_status IN ('publish','static') ";
if(!$show_pass_post) $request .= "AND post_password ='' ";
$request .= "AND comment_approved = '1' ORDER BY comment_ID DESC LIMIT $no_comments";
$comments = $wpdb->get_results($request);
$output = '';
if ($comments) {
foreach ($comments as $comment) {
$comment_author = stripslashes($comment->comment_author);
if ($comment_author == "")
$comment_author = "anonymous";
$comment_content = strip_tags($comment->comment_content);
$comment_content = stripslashes($comment_content);
$words=split(" ",$comment_content);
$comment_excerpt = join(" ",array_slice($words,0,$comment_lenth));
$permalink = get_permalink($comment->ID)."#comment-".$comment->comment_ID;
if ($comment_style == 1) {
$post_title = stripslashes($comment->post_title);
$url = $comment->comment_author_url;
if (empty($url))
$output .= $before . $comment_author . ' on ' . $post_title . '.' . $after;
else
$output .= $before . "<a href='$url' rel='external'>$comment_author</a>" . ' on ' . $post_title . '.' . $after;
}
else {
$output .= $before . '' . $comment_author . ': <a href="' . $permalink;
$output .= '" title="View the entire comment by ' . $comment_author.'">' . $comment_excerpt.'</a>' . $after;
}
}
$output = convert_smilies($output);
} else {
$output .= $before . "None found" . $after;
}
echo $output;
}
}
?>
Also ich verstehe davon garnichts, ich will nur das meine blog seite richtig klappt. :-)
-
Ich bin schon am verzweifeln :-(
-
Danke erstmal toscho,
die function.php zeigt keine fehler, aber die sidebar habe ich so übernommen, wie du es gepostet hast, dort zeigt meine Seite ein Line-Fehler. Das Problem besteht weiterhin. Im Backend eingestellte sidebar ist im Frontend nicht sichtbar. :-(((
-
Ich nutze folgendes Theme:
illacrimo 1.01 von [COLOR=#21759b]Design Disease[/COLOR]
Also, ich habe in der datei, function.php folgendes unter <?php eingeragen:
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<div class="title">',
'after_title' => '</div>',
));
und in der sidebar.php unter <div class="SR"><div class="SRL"> folgendes:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($name_or_number) ) : endif;
?>
Muss ich nach diesen schritten noch weitere Dateien bearbeiten? Waren die Einträge überhaupt an der richtigen Stelle? Meine Seite zeigt zumindest keine Fehler an.
Gruß
Resul -
Hallo,
ich bin ein neuer Blogger, demnach auch neu hier im Forum. Ich hatte mich für ein Theme entschieden, allerdings habe ich erst später gemerkt, das dass Theme kein Widget unterstützt. Nun hatte ich mich auf die Suche gemacht, um mein Theme Widgetfähig zu machen. Habe auf Wordpress gefunden wie man es macht. Habe die Sidbar.php und die Function.php bearbeitet. Es schien so, dass es geklappt hat, aber vergeblich. Folgendes:
Im Backend unter Design/Widgets kann ich per Dropp & Down meine Sidebar gestalten. Nach dem Speichern, wird die Sidebar, aber nicht im Frontend angezeigt.
Woran liegt das?