All you need to do is modify the SQL query. Using the code you linked as a base:
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status="publish" AND year(post_date) = 2010");
if (0 < $numposts) $numposts = number_format($numposts);
The ‘AND’ I added basically gives you all the posts of 2010. Change the year accordingly
Related Posts:
- Simple way to calculate median with MySQL
- Blog statistics
- Possibility to Display Most used Words?
- Counting number of visits to my website
- Looking for references to WordPress Popularity Statistics
- Check which user saw which page
- Looking for simple and lightweight plugin for post reading stats
- Remove views in single post [closed]
- How to move my stats to a self-hosted website?
- Still using WP Stats without Jetpack
- Delete old JetPack Site Stats? encrypted_search_terms in top search terms [closed]
- Plugin to show how far users are reading? [closed]
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What’s the best way to search for a UPC code in a Database?
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between “INNER JOIN” and “OUTER JOIN”?
- What is the difference between UNION and UNION ALL?
- Selecting COUNT(*) with DISTINCT
- Case in Select Statement
- What is a stored procedure?
- ORA-00904: invalid identifier
- SQL WITH clause example [duplicate]
- What is an index in SQL?
- Inserting multiple rows in a single SQL query? [duplicate]
- What exactly does numpy.exp() do? [closed]
- Unknown column in ‘field list’ error on MySQL Update query
- Unknown column in ‘field list’ error on MySQL Update query
- SQL Inner-join with 3 tables?
- The wait operation timed out. ASP
- What is SELF JOIN and when would you use it? [duplicate]
- The wait operation timed out. ASP
- Conversion failed when converting date and/or time from character string while inserting datetime
- Self Join to get employee manager name
- How do I UPDATE from a SELECT in SQL Server?
- SQL error “ORA-01722: invalid number”
- how to fix oracle ORA-01722 invalid number error
- f-statistics and p value suggest different results
- In R, how to find the standard error of the mean?
- SQL query to select dates between two dates
- What’s the difference between INNER JOIN, LEFT JOIN, RIGHT JOIN and FULL JOIN? [duplicate]
- In R, how to find the standard error of the mean?
- MySQL – Operand should contain 1 column(s)
- SQL SELECT WHERE field contains words
- Conversion failed when converting date and/or time from character string while inserting datetime
- When should I use CROSS APPLY over INNER JOIN?
- MySQL “CREATE TABLE IF NOT EXISTS” -> Error 1050
- Insert Data Into Temp Table with Query
- QL Error: ORA-00933: SQL command not properly ended
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- SQL query to get the employee name and their manager name from the same table
- MySQL create table if not exists and insert record only if table was created
- error, string or binary data would be truncated when trying to insert
- How to create Temp table with SELECT * INTO tempTable FROM CTE Query
- NOT IN vs NOT EXISTS
- SQL SELECT WHERE field contains words
- Online SQL Query Syntax Checker
- How can I do an UPDATE statement with JOIN in SQL Server?
- Must declare the scalar variable
- How to normalize a NumPy array to a unit vector?
- ORA-00979 not a group by expression
- T-SQL split string
- ORA-00907: missing right parenthesis
- How do I use properly CASE..WHEN in MySQL
- Must declare the scalar variable
- What is “Advanced” SQL?
- Rename column SQL Server 2008
- How to plot ROC curve in Python
- Why do we need “Relationships” between tables at all?
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Using group by on multiple columns
- Efficiently convert rows to columns in sql server
- How to turn IDENTITY_INSERT on and off using SQL Server 2008?sql-server-2008
- How to delete duplicate rows in SQL Server?
- The SQL OVER() clause – when and why is it useful?
- Update multiple columns in SQL
- How can I do a FULL OUTER JOIN in MySQL?
- Nested select statement in SQL Server
- INSERT statement conflicted with the FOREIGN KEY constraint – SQL Server
- Using group by on multiple columns
- SQL SELECT WHERE field contains words
- SQL Query with NOT LIKE IN
- MySQL query String contains
- How do I escape a single quote in SQL Server?
- What’s the difference between VARCHAR and CHAR?
- Cannot delete or update a parent row: a foreign key constraint fails
- Cannot delete or update a parent row: a foreign key constraint fails
- SQL Server IF EXISTS THEN 1 ELSE 2
- Case statement in MySQL
- How to update multiple columns in single update statement in DB2
- Rename a column in MySQL
- T-SQL split string based on delimiter
- How to declare a variable in MySQL?
- How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
- Finding duplicate values in a SQL table
- ORA-01843 not a valid month- Comparing Dates
- Cannot delete or update a parent row: a foreign key constraint fails
- SQL Query with SUM with Group By
- MySQL Cannot Add Foreign Key Constraint
- How to normalize a NumPy array to a unit vector?