Git Product home page Git Product logo

wp-posted-today's Introduction

Posted Today

** by cog.dog **


If this kind of stuff has any value to you, please consider supporting me so I can do more!

Support me on Patreon Support me on via PayPal


Provides a [postedtoday] shortcode that generates a list of posts from previous year on the same month and day as today. Shortcode options let you also to show results for a specific month/day.

See it in Action

Installation

  1. Upload wp-posted-today folder to the /wp-content/plugins/ directory (or upload via Plugins the zip file of this repository
  2. Activate the plugin through the 'Plugins' menu in WordPress

Using Shortcode

Use the [postedtoday] shortcode in any page to create a list by year of posts on the current day, includes a post excerpt

For an arbitrary day, include a month= and day= parameter, e.g. [postedtoday month="4" day="1"]

Hide the post excerpts via [postedtoday excerpt="0"]

Use the more='...' option to add text to append a "more" link at the end of the excerpt (e.g. for microblog type posts that lack titles). [postedtoday more="(read more...)"]

CSS

Modify output with custom CSS.

Output looks like:

<ul class="todaypost">
  <li><strong>Month Day, Year</strong>
	 <ul>
		<li>
		    <a href="http://blog.blog/blah">Post Title</a> 
		      <span class="today_excerpt">excerpt excerpt excerpt excerpt</span>
		  </li>
	 </ul>
 </li>
 </ul>

Possibilities for CSS include:

Hide bullets for the year list items ul.todaypost > li { list-style-type: none; }

Reduce line height for posts, add margin to space them out ul.todaypost > li > ul > li { line-height: 1.0; margin-bottom: 1em; }

Smaller excerpt size, move below title by making it a block display span.today_excerpt { font-size: 0.8em; display: block; }

Changes

  • v0.1 Just got it working!
  • v0.2 Adjusted the sentence announcing the number of posts to be grammatically correct for a result of 1
  • v0.3 Refined call to get current year in loop
  • v0.4 Date fixes, html cleanup, output set for langauage translation
  • v0.5 Debugged for not showing the count, added option for a "more" tag

wp-posted-today's People

Contributors

cogdog avatar mcleodchris avatar

Stargazers

Nitin Khanna avatar  avatar Chris Aldrich avatar Brian avatar  avatar Aaron Davis avatar

Watchers

 avatar James Cloos avatar Chris Aldrich avatar

wp-posted-today's Issues

gettting the year/date for a post not working in my WP install

Not sure why but the line
$post_year = date("Y", strtotime( get_the_date() ));
in your code
gives me the current year, breaking the entire if then loop that creates the strong header per year.

When I changed it to $post_year = get_the_date('Y');
it worked as your examples suggest.

I'm on WP 5.0.3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.