I want to set the post numbering for each category and not the posts as a whole
]]>`<?php
/*
Plugin Name: Auto Numbering Post
Plugin URI: https://dev.coziplace.com/free-wordpress-plugins/auto-numbering-post
Description: Automatically numbering all published posts based on the publish date and display the number in front of all published post titles.
Version: 1.3
Author: Narin Olankijanan
Author URI: https://dev.coziplace.com
License: GPLv2
*//* Copyright 2012 Narin Olankijanan (email: [email protected])
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin St, Fifth floor, Boston MA 02110-1301 USA
*/add_action( ‘the_title’, ‘dk_auto_numbering’ );
function dk_auto_numbering($title) {
$post_ID = get_the_ID();
$the_post = get_post($post_ID);
$category =
$date = $the_post->post_date;
$maintitle = $the_post->post_title;
$count=”;if ($the_post->post_status == ‘publish’ AND $the_post->post_type == ‘post’ AND in_the_loop()) {
global $wpdb;$count = $wpdb->get_var(“SELECT count(*) FROM $wpdb->posts $wpdb->post_id WHERE post_status=’publish’ AND post_type=’post’ AND post_date<‘{$date}'”);
if ($maintitle==$title) {
$count = $count.”;
$title = $title.’ – Chapter ‘;
} else {
$count =”;
}
}return $title.$count;
}
/* EOF */</blockquote>
Hi
thanks for this plugin – I need to separate the $count from the title, so I can style it differently. I have succeeded in wrapping the count in a span class, but probably not in a sensible way (myphp knowledge is limited) how would I change the output to achieve this?
$count = $wpdb->get_var(“SELECT count(*) FROM $wpdb->posts WHERE post_status=’publish’ AND post_type=’post’ AND post_date<‘{$date}'”);
if ($maintitle==$title) {
echo ‘<span class=”number”>’;
$count = $count.'</span>:’;
} else {
$count =”;
Secondly is there anyway to begin the count from 1 rather than 0?
Thanks,
D
Where can i find the setting menu because i want to manually place numbers on a specific post
2 I would also want to change the color of the number.
]]>bug:Undefined variable: count in wp-content/plugins/auto-numbering-post/auto-numbering-post.php on line 39
my site on multisite mode.
]]>