Bill Erickson
Forum Replies Created
-
Forum: Plugins
In reply to: [Display Posts - Easy lists, grids, navigation, and more] Sibling pagesAh, I see what you’re saying. No, that isn’t possible with the settings currently built into the plugin, but you could pass your own custom parameter (ex:
siblings="true") and then use thedisplay_posts_shortcode_argsfilter to check for that parameter and customize the query.This is untested, but something like this: https://gist.github.com/billerickson/d8776675157a74fe3b9a18f9372366d2
Forum: Plugins
In reply to: [Display Posts - Easy lists, grids, navigation, and more] Sibling pagesHere you go!
[display-posts post_type="page" post_parent="current" exclude_current="true"]By default it will only display however many posts you have set in Settings > Reading (the WP default is 10).
But you can use the
posts_per_pageparameter to change this. Ex:[display-posts posts_per_page="9999"]I think the simplest approach is a find/replace. Something like this:
add_filter( 'display_posts_shortcode_output', function( $output ) {
$custom_title = get_post_meta( get_the_ID(), 'cwp_custom_title', true );
if( ! empty( $custom_title ) ) {
$output = str_replace( get_the_title() . '</a>', $custom_title . '</a>', $output );
}
return $output;
} );Forum: Plugins
In reply to: [Display Posts - Easy lists, grids, navigation, and more] PHP compatibilityYes, the Display Posts plugin is compatible with PHP 8.2. The Display Posts website (which uses the shortcode extensively for displaying content) is already running PHP 8.2.
While that’s not currently a built-in feature of the plugin, I just created this code snippet which gives you that functionality by using
[display-posts s="current"].https://displayposts.com/2024/07/30/display-the-current-search-results/
Forum: Plugins
In reply to: [Display Posts - Easy lists, grids, navigation, and more] Certain post by idTry this:
[display-posts id="3333, 4321, 1234" orderby="post__in"]I’ve tested with the latest version and there are no updates required, so I have updated the “Tested To” version to WP 6.5.
It sounds like this might be an issue with your theme. Adding the shortcode to one sidebar should not change it in another sidebar. That’s not standard WP functionality, so maybe your theme has some custom code to try and sync the sidebars?
That definitely sounds like a caching issue. You might try adding a query parameter to the URL, like https://merionwest.com?asdf to see if that clears it.
This plugin does not include any caching, so the caching is most likely coming from your host of a plugin.
Hi JA,
I think what you’re looking for is the output filter, which lets you completely customize the output of this shortcode.
That’s a great idea. I just added it as a GitHub issue and I’ll add it the next time I’m working on the plugin.
Thanks
That’s an interesting request! It took me a bit of digging to figure out a solution.
First, add an attribute to your shortcode, like
[display-posts reverse="true"]Then, use the
display_posts_shortcode_argsfilter to check for that attribute, and if present, add an attribute to the query args.Finally, use the
posts_resultsfilter in WP core to check for your custom attribute, and if present, reverse the post listing usingarray_reverse.Here’s the full code:
// look for reverse="true" and add an attribue to WP_Query add_filter( 'display_posts_shortcode_args', function( $args, $original_atts ) { if ( isset( $original_atts['reverse'] ) && filter_var( $original_atts['reverse'], FILTER_VALIDATE_BOOLEAN ) ) { $args['dps_reverse'] = true; } return $args; }, 10 , 2 ); // once the posts have been retrieved, check for that attribute and reverse them add_filter( 'posts_results', function ( $posts, $query ) { if ( isset( $query->query['dps_reverse'] ) ) { $posts = array_reverse( $posts ); } return $posts; }, 10, 2 );- This reply was modified 2 years ago by Bill Erickson. Reason: remove inaccurate inline comments
I’m sorry but I believe you’re reporting an issue for a different plugin. The error message references this plugin: https://ww.wp.xz.cn/plugins/display-post-types/
Forum: Plugins
In reply to: [Shared Counts - Social Media Share Buttons] Change Twitter icon to XThe twitter logo was changed to X in the most recent release (1.5.0). Here’s the commit with the change.
Are you using the shared_counts_link filter in your theme to modify the shared counts button and load icons from your theme? That’s the only way I can think that you’d still have the old Twitter icon.