Updated Today


About the “Updated Today” Plugin:
This is a WordPress Plugin that will display a graphic in the upper left corner of the blog when the blog has been updated the day of the view. This is my first plugin and I intend to make more. If there are any problems with this plugin let me know in the comments. Any suggestions are welcome and comments please.

Download version 2.5

Compatability:
This is tested on the most recent version of WordPress. The minimum for this plugin is WordPress 2.7.1.

To install this plugin within WordPress
1. Login to your WordPress admin area
2. From the Plugins menu choose “Add New”
3. Search for ‘updated today’
4. Verify that it’s the ‘Updated Today Plugin’ and click ‘Install’
5. You should now have ‘Updated Today’ as an option in the Settings menu, go there and set up the plugin to your liking.

To install this plugin manually:
1. Download the .zip archive
2. Unzip and upload the “updated-today-plugin” folder to your “wp-content/plugins/” directory
3. Then simply Activate the Plugin
4. If it does not display be sure to check that this line of code is in the footer.php file of your theme:

wp_footer();

Change Log:
–Version 2.5–
Moved CSS into wp_enqueue_style
Moved pngfix.js into wp_enqueue_script
Added ability to upload images

–Version 2.4–
Added an option to make the image a link to the most recent post.
Cleaned up the options to a single Datbase Entry to require less calls to the get_option function. This also imports your old settings automatically.

–Version 2.3–
Cleaning a little house from old settings and code.
Plugin now sets defaults upon activation and removes settings from the options table when deactivated.

–Version 2.2–
Added the ability to change what post types (post or page) and if it’s modified or published status that is checked. Also added the option for if the banner displays in the header area, or the footer area. Useful for some themes if it just won’t display correctly.

–Version 2.1.1–
Changed date(“Y-m-d”); to use date_i18n(“Y-m-d”); to avoid date conflicts when timezones are set in WordPress

–Version 2.0–
Added a ‘Settings’ page in which you can choose your image to display, the side of the page it displays on and allows the blogger to upload their own images to the specified folder.

–Version 1.8.1–
Cleaned up the whitespace on the CSS and added CSS to make the padding and margin on the image ’0′.

–Version 1.8–
Modified database query to use the $table_prefix variable for databases containing multiple WordPress installations as well as people who modified the $table_prefix on setup.
Big thanks to Georg and TeraS for their help on testing for this one!

–Version 1.6.1–
Fixed an error with some themes that made their header image use a Z-Index of 99, which matched that of the plugin. Changed the plugin Z-Index to 100. – thanks TeraS

–Version 1.6–
Fixed the banner from displaying when a draft was created by adding the post_status query to only include posts with the status of ‘publish’

–Version 1.4–
Fixed the issue with not displaying transparent in Internet Explorer
Fixed link of the banner to now go to the post id instead of the guid URI

–Version 1.3–
Plugin is now fully WC3 Compliant
Minor CSS style changes
Added configuration boolean (true/false) settings for placement, style, and pngfix.
Added link to the most current post
Known Issues:
When a picture is used in a post, that picture becomes the target of the link on the banner.

–Version 1.2–
Chromakode is now helping me out with some of the testing and coding.
Improved WC3 compatability (still one more issue to resolve with code placement)

–Version 1.1–
Included pngfix.js in to the plugin folder in order to make for an easier install. This allows for transparent png’s to be visable in Internet Explorer.
Thanks to http://homepage.ntlworld.com/bobosola/ for the PNGFIX code.

–Version 1.0–
This is the initial release of the plugin.
Possible issues:
Not certain if every WordPress install uses the same field names for the post_date and same table names.

{ 67 comments… read them below or add one }

Joerg Schueler July 3, 2009 at 2:50 pm

I have a great problem. Even when i activate the Plugin it dont work and display at the end of page:
Theme: INOve and the same problem with BlogPimp

Warning: mysql_query() [function.mysql-query]: Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) in /mnt/web2/…/wp-content/plugins/updated-today-plugin/updated-today.php on line 46

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /mnt/web2/…/wp-content/plugins/updated-today-plugin/updated-today.php on line 46

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/web2/…/wp-content/plugins/updated-today-plugin/updated-today.php on line 47

Chris K July 3, 2009 at 3:51 pm

@Joerg Schueler
Everything I can find related to this error suggest that you may need to contact your hosting provider or server administrator concerning a possible Database issue. I am running the same theme you are with Inove without error at this time. Some more detail might be helpful. What version of Wordpress, the theme, and also if you have any specific settings you needed to do to get your hosting account to run Wordpress that were different from a standard installation. I’ll be glad to see if I can help you out just need a little more information as this seems very localized to your installation.

Joerg Schueler July 4, 2009 at 2:39 am

First: sorry about my crazy english ;-)

I don’t think it a provider problem becaus it works first time.
Now i deaktivate every plugin and locate the problem with then “ChCounter Widget” Version 2.6.2 by Kolja Schleich http://kolja.galerie-neander.de/plugins/chcounter-widget/

Perhaps you have a hint or alternate for me.

Joerg Schueler July 4, 2009 at 3:21 pm

Sorry. i forgot the WP Version is 2.8 standard installation and inove version is 1.4.5
Thanks a lot for you help.

Chris K July 4, 2009 at 8:20 pm

@Joerg Schueler
Ok, after some further review, it looks like that plugin you are using requires a connection to a separate database than Wordpress’ to do it’s counter calculations because chCounter requires it’s own MySQL database to connect. If you disable only the chCounter does it work fine? If it does then there is your problem. What is probably happening is that the chCouter plugin is running it’s database connection string and then my plugin is running a query, assuming that the only active MySQL connection is the Wordpress connection (as follows Wordpress codex) and so my plugin is trying to query your chCounter database which does not work.

Joerg Schueler July 5, 2009 at 2:21 am

Thanks for your help, now i fix it down to only one error line by adding “$chCounter_force_new_db_connection = FALSE;” to the chCounter Script. So the script use the existing database connection.
Btw. the chCounter database is the same as WordPress used only his own tables.

Perhaps you have a solution for this last error line to fix because my knowing about php and databases is very low.

The last error:
(Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/web2/41/06/518806/htdocs/joergschueler/wp-content/plugins/updated-today-plugin/updated-today.php on line 47)

Chris K July 5, 2009 at 6:20 am

@Joerg Schueler
That error is getting caught on the following section but specifically line 47:

        global $table_prefix;
        $today = date("Y-m-d");
        $status = 'publish';
        $query = MySQL query removed for length
        $results = mysql_query($query);
47      $num_results = mysql_num_rows($results);

This is valid even according to the PHP manual:
http://www.php.net/manual/en/function.mysql-num-rows.php

It may be due to the global $table_prefix; if you have not yet defined the table prefix value in the wp-config.php file.

Joerg Schueler July 5, 2009 at 2:58 pm

Problem seem to be fixed and i send you changes code by email.

thanks for your really good support and help.

TeraS July 10, 2009 at 6:35 pm

Just a quick hi and hope all is kk with you Chris! Tera

Wayne July 28, 2009 at 1:40 pm

Thanks for the update Chris. Especially appreciate the new settings page. Great job!!

Paul Moxon August 3, 2009 at 9:13 am

Missing file question mark icon appears in upper left corner.

On Settings page I found this:

Fatal error: Call to undefined function: scandir() in /home/content/ [ ... ] /plugins/updated-today-plugin/updated-today.php on line 88

Chris K August 3, 2009 at 5:13 pm

@Paul Moxon
Can I get some information about what type of server you are hosting this on? As long as it has PHP you should have the scandir() function accessible. Let me know and I’ll see if there is something I can do to resolve it on my end.

Also if you could let me know of the permissions you have on your ‘plugins’ directory.

Thanks.

Paul Moxon August 3, 2009 at 5:57 pm

I have since upgraded to 2.8.3 and no longer see the question mark nor the banner.

OS Linux
Server Apache
PHP v4.3.11
MYSQL v4.0.27-max-log

By permissions do you mean are there other administrators?

Paul Moxon August 3, 2009 at 6:37 pm

Correction: the question mark shows in Safari but not Firefox

Paul Moxon August 4, 2009 at 5:42 am

The new version fixed it. Chris K. rocks!

ma7aba star September 5, 2009 at 5:09 am

nice
very good
but how i can but it in the rigth side

ma7aba star September 5, 2009 at 5:16 am

nice
very good
but how i can but it in the right side

Paul Moxon September 23, 2009 at 11:13 am

Problem returns. Question mark instead of .png graphics in Options (and blog pages).
Deleted plugin from server, then uploaded new copy. No improvement. No error messages. http://thinkletterpress.com/

Chris K October 7, 2009 at 8:47 am

@Paul Moxon

Hey Paul, sorry I missed your comment. Are you still having issues? Let me know I’ll go ahead and see what I can find out. Just email me with any details chris [at] chriskdesigns [dot] com

ma7aba star October 19, 2009 at 11:35 am

Thank you
And is available in Arabic on this link

http://www.ma7abah.com/blog/?p=128

eko prasetyo January 25, 2010 at 9:10 am

I have a problem. I activate this plugin. All my banner lost, include template banner. Please to help me. Thank you.

Chris K January 25, 2010 at 9:16 am

@eko prasetyo

I looked at the URL you provided http://ekopras.com/ and the banner displays as well as your header. It does appear you need to set the position to ‘Left’ instead of ‘Right’. If you have a different URL you are having issues with let me know.

Thanks!

TeraS April 22, 2010 at 6:23 am

Hi Chris!

Hoping that all is well with you and yours…

I updated to 2.2 this morning and that problem I had in the past with the Mandigo theme and the banner being covered over by the header image has reappeared…

FYI!

Tera

Chris K April 22, 2010 at 8:26 am

@Tera,

Thanks for the info Tera. Glad we got it worked out with you. Modifying the ‘Insert Into:’ option worked for this case. It will still display at the top if you choose footer, it’s simply related to where the script inserts the function. The CSS forces the banner to display at the top of the page. I’ll push an update tonight to better explain this setting.

GeorgWP July 4, 2010 at 4:56 am

Hi Chris,

Nice work. Your plugin keeps getting better and better!

I have a little problem. One of my themes has a fixed width of 960px. If the user’s browser is wider than that – it happens now and then with the big monitors that people have nowadays – the updated image is placed above the background, not above the theme.

One easy solution, I think, would be to add a short code for your plugin. This would make it possible for me to embed it in one of my themes hooks and then style it relative to the container.

Any chance of that?

Leave a Comment

{ 7 trackbacks }