Compact Archives

الوصف

The built-in WordPress archives widget is great for new blogs, but it doesn’t look as good for more established blogs like WPBeginner. Compact Archives displays the monthly archive of posts in a more compact form rather than the usual long list. It can be shown as a compact block suitable for the body of an archives page:

2009: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2008: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2007: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

or in an even more compact form to fit a sidebar:

2009: J F M A M J J A S O N D
2008: J F M A M J J A S O N D
2007: J F M A M J J A S O N D

or something in between:

2009: 01 02 03 04 05 06 07 08 09 10 11 12
2008: 01 02 03 04 05 06 07 08 09 10 11 12
2007: 01 02 03 04 05 06 07 08 09 10 11 12

Compact Archive plugin works seamlessly with Gutenberg Block Editor, Classic Editor, and WordPress widgets.

What’s Next

If you like this plugin, then consider checking out our other projects:

  • OptinMonster – Get More Email Subscribers with the most popular conversion optimization plugin for WordPress.
  • WPForms – Best Drag & Drop WordPress Form plugin (over 1 million active installs).
  • MonsterInsights – See the Stats that Matter and Grow Your Business with Confidence. Best Google Analytics Plugin for WordPress.
  • SeedProd – Jumpstart your website with the #1 Coming Soon & Maintenance Mode Plugin for WordPress.
  • WP Mail SMTP – Improve email deliverability for your contact form with the most popular SMTP plugin for WordPress.

Visit WPBeginner to learn from our WordPress Tutorials and find out about other best WordPress plugins.

Like all plugins, Compact Archives is only available for self-hosted WordPress sites. So YES you need to switch from WordPress.com to WordPress.org in order to use this plugin on your WordPress site. For more details, see the infographic on Self hosted WordPress.org vs Free WordPress.com

If you like this plugin, then please leave a good rating. For support just ask the questions here in the support forum.

Credits

This plugin was originally created by Rob Marsh and Aldolat added a widget for it. WPBeginner adopted the plugin and took the responsibility of keeping it updated.

لقطات الشاشة

  • Compact archives displayed in block layout
  • Gutenberg block

المكوّنات

تقدّم هذه الإضافة مكوّن واحد (1).

  • WPBeginner

التنصيب

  1. Upload the plugin folder to your /wp-content/plugins/ folder.

  2. Go to the Plugins page and activate the plugin.

  3. Put <?php compact_archive(); ?> at the place in your template
    where you want it to appear, e.g., in your sidebar:

    <ul>
        <?php if ( function_exists( 'compact_archive' ) ) compact_archive(); ?>
    </ul>
    
  4. You can also use shortcode [compact_archive] in a page or post to display compact archives. See FAQ for shortcode parameters.

  5. There is also a Compact Archives Widget which can be used to display compact archives in sidebar or any widgetized area.

الأسئلة المتكررّة

How Do I Get the Different Layouts?

The template tag, compact_archive, has some parameters:

    compact_archive($style='initial', $before='<li>', $after='</li>');

If $style == ‘initial’ (the default) the display will fit into a sidebar:

    2009: J F M A M J J A S O N D
    2008: J F M A M J J A S O N D
    2007: J F M A M J J A S O N D

If $style == ‘block’ the display will be wide enough to fill the main column of a page:

    2009: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    2008: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
    2007: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

If $style == ‘numeric’ the display will use month numbers:

    2009: 01 02 03 04 05 06 07 08 09 10 11 12
    2008: 01 02 03 04 05 06 07 08 09 10 11 12
    2007: 01 02 03 04 05 06 07 08 09 10 11 12

$before and $after wrap each line of output. The default values make
each line of the archive into a list item:

    <ul>
        <?php compact_archive(); ?>
    </ul>

How do I get different layouts using shortcode?

The shortcode [compact_archive] works just like the template tag. It accepts three parameters which are style, before, and after.

Using shortcode [compact_archive style="block"] will display compact archives in block.

Using shortcode [compact_archive style="numeric" before="<p>" after="</p>"] will display compact archive in numeric form, wrapped in a paragraph tag.

How do I get different layouts using Compact Archive Widget in Sidebar?

Compact Archive comes with a sidebar widget located Appearance -> Widgets. Drag and drop Compact Archives Widget to your sidebar. The widget has three option fields. You can provide your widget a title if you want or leave it blank. You can choose a display layout from Select the Style option. It has three layout choices to choose from which are initials, block, and numeric. Tansform text option can be left to No Transformation or you can tansform text style to UPPERCASE or Capitalize.

Is There Any Scope for CSS Styling?

The year links at the start of each line are wrapped in tags while months with no posts are wrapped with so you can differentiate them visually using your style sheet.

What if My Site is in Another Language?

The plugin chooses month names and abbreviations according to the language locale, WPLANG, set in wp-config.php.

Compact Archives also honours whatever kind of permalink pattern you have set.

المراجعات

2 أبريل، 2021
Very simple and works, however, the title attribute is stuck on 2001. I’d suggest the plugin author fix this officially by changing the hardcoded 2001 to $year on line 97 of inc/compact-archives.php.
3 سبتمبر، 2016
The plugin works great! If u plan to use the plugin for a different language website and don’t want to rely on the WPLANG variable (deprecated after WP 4.0) you should edit the plugin and simply replace the existent localization DIR to something like this: setlocale(LC_TIME, "ro_RO"); // set localization language where ro_RO is the code for Romanian, fr_FR for French, etc.
إقرأ جميع المراجعات 9

المساهمون والمطوّرون

“Compact Archives” هو برنامج مفتوح المصدر. وقد ساهم هؤلاء الأشخاص بالأسفل في هذه الإضافة.

المساهمون

لقد تم ترجمة ”Compact Archives“ إلى لغة واحدة. شكراً إلى جميع المُترجمين لمُساهماتهم.

ترجمة ”Compact Archives“ إلى لغتك.

مُهتم بالتطوير؟

تصفّح الشفرة، تحقق من مستودع SVN، أو الاشتراك في سجل التطوير بواسطة RSS.

سجل التغييرات

4.1.0

  • New: Support the block based Widget editor introduced in WordPress 5.8.

4.0.0

  • New: Improve caching of database queries by using the WordPress object cache.
  • Enhancement: Use WordPress Core date internationalization.
  • Enhancement: Use language files generated by translate.wordpress.org.
  • Fix: Styling fixes for block editor archive block.
  • Minimum version of WordPress updated to 4.7.

Earlier changelog entries can be found in changelog.md.