Post the content of a specific “Custom Post Type” post within a post using a shortcode

I would suggest creating a new custom taxonomy for relations between a post and its “tracks” or grouping of track posts if you’d like that way you can easily create a shortcode that will query all the needed tracks at once using a shortcode instead of calling your shortcode over and over and to order … Read more

Create a shortcode in WordPress, again

// Declare your shortcode add_shortcode(“download”, “downloadFunction”); // Second Declare your shortcode function function downloadFunction($att, $content, $code){ // your function is passed 3 Arguments // $atts : this is an array of the shortcode’s attributes // $content : this is the content between the code. in your case the file url. // $code : this is … Read more

How to format shortcode’s HTML in external file

function wpse450_show_video( $atts ) { extract(shortcode_atts(array( ‘id’ => 0 ), $atts )); if( is_numeric($id) ) { $ngvideo_title = get_the_title($id); } ob_start(); include ‘path/to/file/video.php’; return ob_get_clean(); } add_shortcode( ‘ngvideo’, ‘wpse450_show_video’ ); You can use $id, $atts in our file as you would in your function. The code in your file will behave just like it would … Read more

getting values from a shortcode with an include

include changes the scope. You would need to declare $classslider global before defining it, and then use global $classslider; before using it. function bf_shortcode_slideshow($atts) { global $classslider; extract(shortcode_atts(array( … I think that will fix your problem. I don”t understand why you are using include at all though. There must be a better way to make … Read more

Adding short codes from a page’s content on header and hiding the same from page’s content

This might work for you, trying to hook early to the_content filter to strip the shortcode tag from it: add_filter(‘the_content’, ‘ad_filter_the_content’,1,1); function ad_filter_the_content($content) { // specify page id or array of page ids to include if (is_page(5)) { return str_replace(‘[orbit-slider category=”test”]’, ”, $content); } return $content; }

wp_specialchars and wp_specialchars_decode in a shortcode plugin

The Codex description of these two functions: wp_specialchars: Converts a number of special characters into their HTML entities. Specifically deals with: &, <, >, “, and ‘. wp_specialchars_decode: Converts a number of HTML entities into their special characters. According to http://codex.wordpress.org/Function_Reference/wp_specialchars This function is deprecated as of WordPress 2.8.0. Please use esc_html instead. You don’t … Read more

how to show database content in wordpress post

For the sake of the example, I’ll assume you to have copied the relevant Table to the WordPress DB, to have named it wp_my_xtra_table and it to contain 3 columns (id,num_val,str_val). function wpse106832_shortcode_demo( $atts ) { global $wpdb; extract( shortcode_atts( array( ‘id’ => 1 ), $atts ) ); $table_row = $wpdb->get_row( ‘SELECT * ‘ . … Read more