Gaurav Tiwari
Forum Replies Created
-
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] [year] not parsing on Bricks BuilderShould be fine now.
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] [year] not parsing on Bricks BuilderCurrently it parses shortcodes to fields were bricks supports any shortcode, for example Content element. Bricks already have date based {shortcodes} but I see that it could be useful in the wider context. I will push an update for this. Thank you for reporting.
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] [Bug] in “year with offset” shortcodeJust pushed the update @andrechaperon. Please test it and let me know if something bothers you again. π
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] Option to avoid adding core filters?Added in 1.7.1:
Disable all core filters (shortcodes will work but will only work in post content and blocks):
add_filter( 'dmyip_core_filters', '__return_empty_array' );Disable specific filters β e.g., stop
do_shortcodeonthe_title(fixes ACF field name conflicts):add_filter( 'dmyip_core_filters', function ( $filters ) { $filters['the_title'] = false; return $filters; } );Disable multiple filters at once:
add_filter( 'dmyip_core_filters', function ( $filters ) { $filters['the_title'] = false; $filters['single_post_title'] = false; $filters['wp_title'] = false; return $filters; } );Only keep excerpt processing (disable everything else):
add_filter( 'dmyip_core_filters', function () { return array( 'the_title' => false, 'single_post_title' => false, 'wp_title' => false, 'the_excerpt' => true, 'get_the_excerpt' => true, 'get_the_archive_title' => false, ); } );Available filter keys Key WordPress filter What it does
the_titlethe_titleProcesses shortcodes in post titles displayed on the pagesingle_post_titlesingle_post_titleProcesses shortcodes in the browser tab title (single posts)wp_titlewp_titleProcesses shortcodes inwp_title()outputthe_excerptthe_excerptProcesses shortcodes in displayed excerptsget_the_excerptget_the_excerptProcesses shortcodes when retrieving raw excerptget_the_archive_titleget_the_archive_titleProcesses shortcodes in archive page titlesAll default to
true. Set tofalseto disable.Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] [Bug] in “year with offset” shortcodeHi AndrΓ©, I’ll be honest – I didn’t try it with such large offsets. I am working on an update and add these improvements to the update. For the time being, I am marking this as resolved, but I will let you know once the update is released.
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] Option to avoid adding core filters?I will add a filter to avoid adding do_shortcode to the native WP elements. It’s not just about ACF – maybe the user doesn’t want it at all.
I just don’t want to add a settings page, otherwise the plugin could have been very customizable.
Hi @jbmkl , glad that it is resolved. Feel free to create a new ticket whenever there is an issue. You can also reach out to me directly from https://gauravtiwari.org/contact/
Wish you the best.
Forum: Reviews
In reply to: [Dynamic Month & Year into Posts] Amazing pluginThank you so much! Really appreciate it. Feel free to create a support thread, if you ever need some help.
Thank you. And yes, I don’t keep SVN and Github in sync but will try from now and on. Pushed a new updated.
Nice ideas. Implemented. Please update to 1.3.9 and let me know if something is still broken.
Here is what I found:
1. WordPress deletes shortcodes from auto-generated excerpts. But if you use a custom excerpt https://cln.sh/v8w0vzYqGCFbmJfP9X2n you will get the desired output. Note that this is a core feature .2. Once you do that, Rank Math loads the meta description correctly as well.
Please let me know if this works for you.
Thanks for the report. I can confirm that this is the case. It hasn’t been tested a lot with FSE themes. I will start working on an update to improve this.
And yes, SEO redirect for logged-out users is disabled.
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] Year change only after annual event heldThis is a very specific use case @paulryken .
You can use this into your child theme’s functions.php or Code Snippets plugin.
add_shortcode('specialdate', 'dmyip_rmd_specialdate');
function dmyip_rmd_specialdate($atts) {
// Set default attributes and merge with user input
$attributes = shortcode_atts(array(
'floor_date' => 'today',
'ceiling_date' => 'last sunday of january next year'
), $atts);
// Parse the floor date using strtotime
$floor_date = strtotime($attributes['floor_date']);
if (!$floor_date) {
return ''; // Clear any error messages
}
// Parse the ceiling date using strtotime
$ceiling_date = strtotime($attributes['ceiling_date']);
if (!$ceiling_date) {
return ''; // Clear any error messages
}
// Calculate the ceiling date next year
$ceiling_date_next_year = strtotime('+1 year', $floor_date);
// Get today's date
$today = time();
// Determine if today's date is between the floor date and the ceiling date next year
if ($today >= $floor_date && $today <= $ceiling_date_next_year) {
// Format the ceiling date with day, month, and year
$display_date = date_i18n('j F Y', $ceiling_date);
return esc_html($display_date);
}
return '';
}
add_shortcode('specialyear', 'dmyip_rmd_specialyear');
function dmyip_rmd_specialyear($atts) {
// Set default attributes and merge with user input
$attributes = shortcode_atts(array(
'floor_date' => 'today',
'ceiling_date' => 'last sunday of january next year'
), $atts);
// Parse the floor date using strtotime
$floor_date = strtotime($attributes['floor_date']);
if (!$floor_date) {
return ''; // Clear any error messages
}
// Parse the ceiling date using strtotime
$ceiling_date = strtotime($attributes['ceiling_date']);
if (!$ceiling_date) {
return ''; // Clear any error messages
}
// Calculate the ceiling date next year
$ceiling_date_next_year = strtotime('+1 year', $floor_date);
// Get today's date
$today = time();
// Determine if today's date is between the floor date and the ceiling date next year
if ($today >= $floor_date && $today <= $ceiling_date_next_year) {
// Format the ceiling date to show just the year
$display_year = date_i18n('Y', $ceiling_date);
return esc_html($display_year);
}
return '';
}It has two components.
[specialdate ceiling_date="last sunday of january next year"]will show the full date like 28 January 2025.[specialyear ceiling_date="last sunday of january next year"]will just show 2025.
In the ceiling_date argument you can ask for dates in natural language.Let me know if this works.
I will be adding this to the plugin as well but only after someone else asks for it.
Forum: Plugins
In reply to: [Dynamic Month & Year into Posts] Previous year in search resultsYes, it happens. I haven’t done anything out of the box with the plugin. It is totally native, so if there is a cache solution available, the dates will be cached for performance.
Glad that it got fixed automagically.
Always feel free to create a new topic if you need any other assistance.