Nu har jeg prøvet at gå ind på de to sider du pastede før, men af en eller anden årsag kan jeg ikke komme ind! Men jeg tænker på, at de mener, at du skal sætte det ind i løkken, hvor du udskriver dine posts... som regel er det en while løkke!
Du kan også prøve at indsætte din kode her i forummet
________________
Hilsen CHadi
Mit lykketal er 2959
Hermed de koder jeg bøvler med...
<?php
/*
Plugin Name: Recent Posts
Plugin URI:
http://mtdewvirus.com/code/wordpress-plugins/ Description: Returns a list of the most recent posts.
Version: 1.07
Author: Nick Momrik
Author URI:
http://mtdewvirus.com/ */
function mdv_recent_posts($no_posts = 5, $before = '<li>', $after = '</li>', $hide_pass_post = true, $skip_posts = 0, $show_excerpts = false) {
global $wpdb;
$time_difference = get_settings('gmt_offset');
$now = gmdate("Y-m-d H:i:s",time());
$request = "SELECT ID, post_title, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' ";
if($hide_pass_post) $request .= "AND post_password ='' ";
$request .= "AND post_date_gmt < '$now' ORDER BY post_date DESC LIMIT $skip_posts, $no_posts";
$posts = $wpdb->get_results($request);
$output = '';
if($posts) {
foreach ($posts as $post) {
$post_title = stripslashes($post->post_title);
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . htmlspecialchars($post_title, ENT_COMPAT) . '">' . htmlspecialchars($post_title) . '</a>';
if($show_excerpts) {
$post_excerpt = stripslashes($post->post_excerpt);
$output.= '' . $post_excerpt;
}
$output .= $after;
}
} else {
$output .= $before . "None found" . $after;
}
echo $output;
}
?>
Hvor jeg senere har indsat: <?php mdv_recent_posts(); ?>
Der hvor funktionen skal vises.
Og så har jeg denne kode (comment-counter)
<?php
/*
Plugin Name: Comment Count
Plugin URI:
http://mtdewvirus.com/code/wordpress-plugins/ Description: Counts the number of comments. Can be used to count total number of comments or comments for a specific post when used "in the loop."
Version: 1.02
Author: Nick Momrik
Author URI:
http://mtdewvirus.com/ */
function mdv_comment_count($all_posts = true) {
global $wpdb, $id;
$request = "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'";
if (!$all_posts) $request .= " AND comment_post_ID=$id";
echo $wpdb->get_var($request);
}
?>
Hvortil der høre denne linie: <?php mdv_comment_count(); ?>
...og denne forklaring:
Place the function call wherever you want the output to appear.
<?php mdv_comment_count(); ?>
The function accepts one optional parameter, which allows you to find the comment count for a particular post when it is used inside the "the loop". If you do not pass a parameter to the function, it defaults to true, counting ALL comments for a WP install. If you call the function like <?php mdv_comment_count(false); ?> it will count the comments for the post that "the loop" is working on.
Men jeg forstår det bare ikke... (ikke fordi jeg ikke kan læse det
- men jeg kan ikke få det til at fungere)