Remove hyperlink on gallery shortcode

Update: It looks like there exists an attribute link=”none” after all 😉 For example: So we don’t need to reinvent the wheel, like in my previous answers 😉 Previous: Plugin to handle link=”no” in the gallery shortcode: Here’s a demo plugin to add the option to remove the image links in the gallery. You can … Read more

Video shortcode – autoplay all videos

I ran into this problem while trying to make HTML videos behave like GIFs. WordPress’s built-in video player uses HTML video elements but does not allow videos to play simultaneously. Instead of using the default WordPress video player (which is best used for more standard video content), I chose to manually use the <video> element … Read more

Execute shortcode twice in the same page

I believe the real issue you had was with echoing your data instead of returning it. A shortcode should return the output to be drawn, which is then drawn in place of the short code. Here is the code using HEREDOC syntax for outputs and the query. I believe this makes things much more readable … Read more

Add attribute to shortcode dynamically

Untested (and can’t test right now) but you ought to be able to add attributes with a filter… something like: function test_sc($atts,$content) { // echo ‘test_sc’; $atts = shortcode_atts( array( ‘foo’ => ‘no foo’, ‘bar’ => ‘default bar’, ), $atts, ‘testsc’ ); // var_dump($atts); } add_shortcode(‘testsc’,’test_sc’); function test_shortcode_att_add($atts) { # this filter should only run … Read more

Placing raw HTML inside a WordPress shortcode

For the sake of having @Milo’s comment as an answer. Your code works as it should, it is just not possible to “write” HTML in the visual editor also in shortcodes. Shorcodes are not treated differently then any other text. If you want formatted HTML in your shortcode you just need to use the normal … Read more