Home › Forums › Pro Support › Shortcode
Tagged: shortcode
- This topic has 17 replies, 4 voices, and was last updated 2 years, 11 months ago by
elvin.
-
AuthorPosts
-
April 27, 2020 at 9:07 am #15089
David
ParticipantHi,
How do I use the shortcode so that I do not need to make a list for every category? for every tag?
Is there a way to do [wp_show_posts id=”76440″ settings=”tag=humanities”]
Thank you for your time?
April 27, 2020 at 4:59 pm #15100Tom
KeymasterHi there,
You can do exactly that.
For example:
[wp_show_posts id="76440" settings="taxonomy=post_tag&tax_term=humanities"]
April 27, 2020 at 5:01 pm #15102David
ParticipantTom is now my best friend.
April 27, 2020 at 5:04 pm #15107David
ParticipantI use the Blog module for GeneratePress Premium and I wanna use the WP Show Posts for the sidebar posts. I can add the shortcode you wrote above into the widget. But how can I make it be aware of which category the blog post has?
Could I use https://en-ca.wordpress.org/plugins/content-aware-sidebars/ with the shortcode above in sidebars?
Thank you.
April 28, 2020 at 4:22 pm #15143Tom
KeymasterHi David,
It wouldn’t be possible to use the shortcode to fill the term dynamically. That would require PHP so we could communicate with WordPress on-the-fly to know which term is being viewed.
Of course, you could use a plugin like Content Aware Sidebars to set up multiple instances of the shortcode and manually add the term name.
April 28, 2020 at 4:29 pm #15152David
ParticipantTom,
Actually, I choose https://wordpress.org/plugins/custom-sidebars/
Add everything is working great.
Before, using Content Views Pro, I had a 1.3 second delay (on average), for unused css on PageSpeed.
Now using WP Show Post, and the built in features of GP Premium, I have only 0.15 second delay for unused css on PageSpeed.
You now get (earn) $75 from me every year.
Thank you for your hard work.
April 29, 2020 at 5:33 pm #15177Tom
KeymasterAwesome!
Thank you! Really appreciate it 🙂
May 3, 2020 at 3:23 am #15263David
ParticipantHi Tom,
How to do a shortcode to filter specific author:
[wp_show_posts id=”76440″ settings=”user_id=35″]
So that the grid only shows posts by that author.
This is my question now.
Thank you.
May 4, 2020 at 4:54 pm #15306Tom
KeymasterHi there,
It’s not possible in the shortcode, unfortunately.
You’ll need to make this change to the core code (it will be in the next update): https://github.com/tomusborne/wp-show-posts/commit/286caf1164db8b6b6f38b85d3a011b519a27f4de
Then you can do this:
add_filter( 'wp_show_posts_shortcode_args', function( $args, $settings ) { if ( 76440 === $settings['list_id'] ) { $args['author'] = 123; } return $args; }, 10, 2 );
May 4, 2020 at 8:55 pm #15324David
ParticipantThis sounds great. I’m looking forward to the update. Thank you so much for your great plugin and theme.
May 5, 2020 at 12:31 am #15329David
ParticipantActually here is the thing. I’m trying to redo the way WordPress does author webpages.
1. Use Yoast to disable the /author/ archives pages.
2. Each contributor writes a full-length professional bio as a post.
3. Use GP Elements and WP Show Posts to include a list of the posts on 2.But WPSP does not allow to filter by author. And the shortcode doesn’t work either.
But Like the list of posts that shows on the /author/ archive pages, if Yoast keeps them enabled.
Can I somehow use the php code in a GP elements, without needing WPSP, because it seems that code I already written.
Any ideas on the best route to take?
David
May 5, 2020 at 4:57 pm #15350Tom
KeymasterSo are you just trying to remove the
/author/
part of the URL then?May 5, 2020 at 6:02 pm #15354David
ParticipantNo. Step 1 says I use Yoast to disable the author pages.
Here is a short video made for you.
Can WPSP help?
Thank You.
May 6, 2020 at 6:05 pm #15371Tom
KeymasterGotcha – sorry for the confusion!
Try this:
[wp_show_posts id="76440" settings="author=35"]
May 6, 2020 at 9:10 pm #15377David
ParticipantYes Tom, this did it just as expected.
My page speed score (98 mobile), download speed (<1s), and user experience have greatly improved since I switch to your theme and plugin.
Thank you so much.
David
-
AuthorPosts
- You must be logged in to reply to this topic.