Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/shortcod...
File: archives.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Archives shortcode
[2] Fix | Delete
*
[3] Fix | Delete
* @author bubel & nickmomrik
[4] Fix | Delete
* [archives limit=10]
[5] Fix | Delete
*
[6] Fix | Delete
* @package automattic/jetpack
[7] Fix | Delete
*/
[8] Fix | Delete
[9] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[10] Fix | Delete
exit( 0 );
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
add_shortcode( 'archives', 'archives_shortcode' );
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* Display Archives shortcode.
[17] Fix | Delete
*
[18] Fix | Delete
* @param array $atts Shortcode attributes.
[19] Fix | Delete
*/
[20] Fix | Delete
function archives_shortcode( $atts ) {
[21] Fix | Delete
if ( is_feed() ) {
[22] Fix | Delete
return '[archives]';
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
global $allowedposttags;
[26] Fix | Delete
[27] Fix | Delete
$default_atts = array(
[28] Fix | Delete
'type' => 'postbypost',
[29] Fix | Delete
'limit' => '',
[30] Fix | Delete
'format' => 'html',
[31] Fix | Delete
'showcount' => false,
[32] Fix | Delete
'before' => '',
[33] Fix | Delete
'after' => '',
[34] Fix | Delete
'order' => 'desc',
[35] Fix | Delete
);
[36] Fix | Delete
[37] Fix | Delete
$attr = shortcode_atts( $default_atts, $atts, 'archives' );
[38] Fix | Delete
[39] Fix | Delete
if ( ! in_array( $attr['type'], array( 'yearly', 'monthly', 'daily', 'weekly', 'postbypost' ), true ) ) {
[40] Fix | Delete
$attr['type'] = 'postbypost';
[41] Fix | Delete
}
[42] Fix | Delete
[43] Fix | Delete
if ( ! in_array( $attr['format'], array( 'html', 'option', 'custom' ), true ) ) {
[44] Fix | Delete
$attr['format'] = 'html';
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
$limit = (int) $attr['limit'];
[48] Fix | Delete
// A Limit of 0 makes no sense so revert back to the default.
[49] Fix | Delete
if ( empty( $limit ) ) {
[50] Fix | Delete
$limit = '';
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
$showcount = ( false !== $attr['showcount'] && 'false' !== $attr['showcount'] ) ? true : false;
[54] Fix | Delete
$before = wp_kses( $attr['before'], $allowedposttags );
[55] Fix | Delete
$after = wp_kses( $attr['after'], $allowedposttags );
[56] Fix | Delete
[57] Fix | Delete
// Get the archives.
[58] Fix | Delete
$archives = wp_get_archives(
[59] Fix | Delete
array(
[60] Fix | Delete
'type' => $attr['type'],
[61] Fix | Delete
'limit' => $limit,
[62] Fix | Delete
'format' => $attr['format'],
[63] Fix | Delete
'echo' => false,
[64] Fix | Delete
'show_post_count' => $showcount,
[65] Fix | Delete
'before' => $before,
[66] Fix | Delete
'after' => $after,
[67] Fix | Delete
)
[68] Fix | Delete
);
[69] Fix | Delete
[70] Fix | Delete
if ( 'asc' === $attr['order'] ) {
[71] Fix | Delete
$archives = implode( "\n", array_reverse( explode( "\n", $archives ) ) );
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
// Check to see if there are any archives.
[75] Fix | Delete
if ( empty( $archives ) ) {
[76] Fix | Delete
$archives = '<p>' . __( 'Your blog does not currently have any published posts.', 'jetpack' ) . '</p>';
[77] Fix | Delete
} elseif ( 'option' === $attr['format'] ) {
[78] Fix | Delete
$is_amp = class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request();
[79] Fix | Delete
$change_attribute = $is_amp ? 'on="change:AMP.navigateTo(url=event.value)"' : 'onchange="document.location.href=this.options[this.selectedIndex].value;"';
[80] Fix | Delete
$archives = '<select name="archive-dropdown" ' . $change_attribute . '><option value="' . get_permalink() . '">--</option>' . $archives . '</select>';
[81] Fix | Delete
} elseif ( 'html' === $attr['format'] ) {
[82] Fix | Delete
$archives = '<ul>' . $archives . '</ul>';
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
return $archives;
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function