WordPress.org

Making WordPress.org

Opened 9 months ago

Closed 6 months ago

Last modified 6 months ago

#3870 closed enhancement (fixed)

Update total plugin counter in WP.org

Reported by: vaishalipanchal Owned by: dd32
Milestone: Priority: normal
Component: General Keywords: has-patch dev-feedback
Cc:

Description

On https://wordpress.org/ we needs to update total plugins counter as per https://wordpress.org/plugins/ page. Also if possible needs to set update plugins counter dynamically by coding so anyone can check it from main page no need to check plugin page.

Attachments (2)

3870.patch (1.1 KB) - added by vaishalipanchal 9 months ago.
3870.2.patch (1.6 KB) - added by vaishalipanchal 9 months ago.
Updated patch.

Download all attachments as: .zip

Change History (13)

#1 @vaishalipanchal
9 months ago

  • Keywords has-patch added; needs-patch removed

#2 @Otto42
9 months ago

  • Keywords needs-patch added; 2nd-opinion has-patch removed

That patch updates the number, but breaks the existing translations. If the number is going to be dynamic, then the translation needs to be static and have the number sprintf'd into it. Also it would need to be run through number_format_i18n and so forth as well.

@vaishalipanchal
9 months ago

Updated patch.

#3 @vaishalipanchal
9 months ago

@Otto42 i have updated patch can you please review it.

Last edited 9 months ago by vaishalipanchal (previous) (diff)

#4 @Otto42
9 months ago

wp_count_posts('plugin') won't work either. The plugin directory is not in the main instance, it is in a separate instance on the multisite system.

#5 @vaishalipanchal
9 months ago

@Otto42 yes i have used $plugin_count = wp_count_posts( 'plugin' )->publish; to get total plugin count as per https://wordpress.org/plugins/ page coding. Which function i have to used to get total plugin counter in main WP.org site? so i can update patch.

Last edited 9 months ago by vaishalipanchal (previous) (diff)

#6 @dd32
9 months ago

@vaishalipanchal It'll probably need code such as:

$number = 50000;
if ( defined( 'WPORG_PLUGIN_DIRECTORY_BLOGID' ) ) {
    switch_to_blog( WPORG_PLUGIN_DIRECTORY_BLOGID )
    $number = count posts..
    restore_current_blog()
}

#7 @vaishalipanchal
9 months ago

  • Priority changed from low to normal

@dd32 i can't test above code in my WordPress Meta folder. can you please suggest me code or add here working patch for plugin counter so ticket goes to close once plugin counter dynamic for Main WP.org website.

#8 @mukesh27
9 months ago

  • Keywords has-patch dev-feedback added; needs-patch removed

#9 @dd32
6 months ago

I'm going to fix this by using a constant which will need updating rather than automatically pulling it from the plugin directory.

The reason is simple - wordpress.org/ doesn't actually run the wporg-main theme and instead is hard-coded. As we already have another hard-coded number here (WP_MARKET_SHARE) introducing another constant here seems fine. It only needs updating every 5-10k plugins which probably coincides with the market share changes anyway.

#10 @dd32
6 months ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 8042:

WordPress Main Theme: Pull in the latest count of plugins on WordPress.org from a new constant rather than hard-coding it.

Props vaishalipanchal for original patch, dd32.
Fixes #3870.

#11 @dd32
6 months ago

In 8046:

WordPress Main Theme: Switch to using the more standard %1$s format that's better known.

Missed in r8042.
Props tobifjellner for noticing.
See #3870.
Fixes #4050.

Note: See TracTickets for help on using tickets.