TED talks shortcode not working

Unfortunately, this is going to be a problem for you. The [ted] shortcode is specific to WordPress.com – not to a self-hosted site where you installed the software yourself from WordPress.org. The only embeds that WordPress.org’s software supports by default are listed in the Codex: YouTube (only public videos and playlists – “unlisted” and “private” … Read more

Display custom post type with shortcode

I think, basically your question is, how to query posts of a custom post type in a shortcode. You should have a look into the WP_Query section of WordPress: https://codex.wordpress.org/Class_Reference/WP_Query In my example code I create a shortcode, which shows the title of the latest published posts of the type ‘my-custom-post-type’: <?php add_shortcode( ‘shortcodename’, ‘display_custom_post_type’ … Read more

Table of Contents with a shortcode

The easiest way would be to replace $content = $toc . $content; with $content = str_replace( ‘[toc]’, $toc, $content ); This would do a search for the string [toc] and replace it with the table of contents. It might be more complicated due to how the plugin would work, but on paper it is simple.

Autoembeds don’t work with paragraphs

The reason why this is happening, seems to be found in the file wp-includes/class-wp-embed.php in the autoembed call-back method: /** * Passes any unlinked URLs that are on their own line to {@link WP_Embed::shortcode()} for potential embedding. * * @uses WP_Embed::autoembed_callback() * * @param string $content The content to be searched. * @return string Potentially … Read more

How to return loop contents

There are replacements that return pure strings for all parts, no need to print anything into an output buffer. I like sprintf() and would write your example like this: <?php if ( $cms_pl_pages->have_posts() ) { $content=”<section class=”cms-pl-gallery”>”; while ( $cms_pl_pages->have_posts() ) { $cms_pl_pages->the_post(); $content .= sprintf( ‘<article class=”cms-pl-item clearfix”> %1$s <h2> <a href=”https://wordpress.stackexchange.com/questions/57000/%2$s” title=”Read %3$s”>%4$s</a> … Read more

How can i put an array as variable in shortcode_atts?

Ok found a solution function product_gallery_shortcode($atts) { extract(shortcode_atts(array( ‘product_id’ => ’31’, ‘prodvid’ => false, ‘youtubeids’=> ”, ‘thumbnr’ =>2 ), $atts)); etc and i had to turn youtubeids into an array again $youtubeidsnew = array(); $youtubeidsnew = explode(‘,’, $youtubeids);

Remove wptexturize from a shortcode?

There is a clue in wp-includes/formatting.php in the function wptexturize: $default_no_texturize_shortcodes = array(‘code’); … $no_texturize_shortcodes=”(” . implode(‘|’, apply_filters(‘no_texturize_shortcodes’, $default_no_texturize_shortcodes) ) . ‘)’; Try using this filter to add a shortcode to the array: function my_no_tex( $shortcodes ) { $shortcodes[] = ‘someshortcode’; return $shortcodes; } add_filter( ‘no_texturize_shortcodes’, ‘my_no_tex’ );