Created
February 11, 2018 17:14
-
-
Save asharirfan/10087b51823a1e7e002a6163cc8bcd69 to your computer and use it in GitHub Desktop.
WordPress Plugin — Reset Post Time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Plugin Name: Reset Post Time | |
| * Plugin URI: https://github.com/asharirfan/reset-post-time | |
| * Description: WordPress plugin to set the seconds of publish/schedule time of post types to zero. | |
| * Author: mrasharirfan | |
| * Author URI: https://AsharIrfan.com/ | |
| * Version: 1.0.0 | |
| * License: GPL2+ | |
| * License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
| * | |
| * @package rpt | |
| */ | |
| // Exit if accessed directly. | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; | |
| } | |
| /* | |
| `Reset Post Time` | |
| Copyright(c) 2018 Ashar Irfan (email : [email protected]) | |
| This program is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License, version 2, as | |
| published by the Free Software Foundation. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| GNU General Public License for more details. | |
| You should have received a copy of the GNU General Public License | |
| along with this program; if not, write to the Free Software | |
| Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| */ | |
| /** | |
| * Function to set the seconds of publish/schedule time | |
| * of post types to zero. | |
| */ | |
| function rpt_reset_post_time() { | |
| // Get WP global variable $pagenow. | |
| global $pagenow; | |
| // Check if the current page is either a new post or a post edit page. | |
| if ( 'post-new.php' === $pagenow || 'post.php' === $pagenow ) { | |
| ?> | |
| <script> | |
| jQuery( '#timestampdiv #ss' ).val( '00' ); | |
| </script> | |
| <? | |
| } | |
| } | |
| add_action( 'admin_footer', 'rpt_reset_post_time' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment