Saving post content to database with do_shortcode?

So I found my answer in the codex. content_save_pre() is my friend. Here is the usage: function my_sanitize_content( $content ) { return do_shortcode($content); } add_filter( ‘content_save_pre’ , ‘my_sanitize_content’ , 10, 1); Haven’t tried it yet, it should work I suppose.

Execute Closing Shortcode After the_content

Maybe I misunderstand what you are doing, and I apologize if that is the case, but… It looks like you are returning content if the post DOES NOT already have one, which looks backward to me based on my understanding of your problem. It looks like you are trying to execute a broken (incomplete) shortcode. … Read more

do_shortcode with custom field

Nice one, you were practically there – the key is to assign the $ecpt_imdb variable with the data returned from get_post_meta: <?php if ( $ecpt_imdb = get_post_meta( get_the_ID(), ‘ecpt_imdb’, true ) ) : ?> <h3>About the Movie</h3> <?php echo do_shortcode( ‘[imdb]http://www.imdb.com/title/’ . $ecpt_imdb . ‘/[/imdb]’ ) ?> <?php endif ?> You’ll see I’ve also used … Read more

Next Post links not working in custom post type shortcode

OK, thank you to ialocin, the $gbquery->max_num_pages solve it! So there is the clean code : function livredor_function($atts,$content=””){ extract(shortcode_atts(array( id => ” ), $atts)); ob_start(); function create_guestbook() { $current_page = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 0; $gbquery = new WP_query(“post_type=inliguestbook&showposts=10&paged=” . $current_page); while($gbquery->have_posts()) { $gbquery->the_post(); ?> <div class=”guestbook”> <h3><?php the_title(); ?> <span><?php the_time(‘j F Y’) ?></span></h3> … Read more

Unable to the get the gallery inserted between shortcodes

I don’t know why the code is not working. But this is how i did this may be helpful for some noob like me <?php $name = get_the_content(); preg_match(‘/\]*)\”]/’, $name, $match); $w3_ids = explode( “,”, $match[1] ); $gallery_count=1; foreach( $w3_ids AS $w3_id ): $src = wp_get_attachment_image_src($w3_id,’full’); ?> <div class=”item <?php if($gallery_count==1)echo “active”; ?>”> <img src=”https://wordpress.stackexchange.com/questions/193166/<?php … Read more

Freeze a shortcode in place?

You can check for user capability (aka non-admins) and remove shortcode you don’t want to be formatted: …in functions.php $cuser = wp_get_current_user(); if (!isset($cuser->allcaps[‘administrator’]) || !$cuser->allcaps[‘administrator’]) { remove_shortcode(‘your_shortcode_tag_name’); } You can also remove all shortcodes using remove_all_shortcodes function.

WordPress shortcodes are not working

The WordPress application (ie. from WordPress.org) does offer some default shortcodes that you can reference. [contact] is not one of them. You seem to be referring to the Shortcodes offered by WordPress.com however these shortcodes are peculiar to sites hosted on WordPress.com – they will not work in your WordPress application. To call other shortcodes … Read more