Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

New answers tagged

0 votes

Show Featured Image Dimensions and size frontend with shortcode

Yes, that is possible. Building upon the answer Nicolai Grossherr gave to Get the size (size in Kb or MB) of an featured image? you could do something like this, // e.g. in functions.php add_shortcode(...
user avatar
0 votes

make user_id in a shortcode dynamic based on who's logged in

One option is to register your own shortcode to act as a wrapper for the plugin's shortcode. In the wrapper callback you would then retrieve the current user's ID and pass it to the actual shortcode. ...
user avatar
0 votes

ShortCode and extra </p>

When using a shortcode in the block editor, I had a really hard time removing extra p tags until I used the "Custom HTML" block and inserted the shortcode in there. Hope this helps someone ...
user avatar
0 votes

How To Use do_shortcode with WooCommerce One Page Checkout

Here's a partial solution that has worked for me so far: If you use the full do_shortcode() as in your example, and you also put the basic [woocommerce_one_page_checkout] shortcode (even without any ...
user avatar
  • 1
1 vote

How can I add a shortcode to query Custom Post Type with ACF in Wordpress?

I ultimately figured out getting a shortcode to work by reworking the code to the following: add_shortcode( 'gr_shortcode', 'gr_shortcode' ); function gr_shortcode() { $buffer = '<h3>...
user avatar
  • 119
0 votes

Excerpt Length & List Category Posts Plugin

Its been almost a decade but just in case anyone else looks this up...there is a parameter excerpt_size that you can add in the shortcode. Example: [ catlist name=mycategory orderby=date order=desc ...
user avatar
0 votes

Get first video from the post (both embed and video shortcodes)

Based on @cybmeta answer, improved it a little bit and though I would share function get_first_embed_media($post_id, $regex_filter = null) { $post = get_post($post_id); $content = do_shortcode(...
user avatar

Top 50 recent answers are included