plugin shortcode not working on ajax request call

…ajax calls can’t show shortcodes because of the admin ajax url that they dont have full access to wordpress enviorment Not true. AJAX calls have exactly the same resources at their disposal as regular WordPress requests. Just make sure to parse the content in the same way the_content() does: $parsed_content = apply_filters( ‘the_content’, $post->post_content ); … Read more

How to create an incremental list using shortcodes?

What you want is to use shortcode attributes. I Googled “wordpress shortcode attributes” and found the sample code below in the WP Codex // [bartag foo=”foo-value”] function bartag_func( $atts ) { $a = shortcode_atts( array( ‘foo’ => ‘something’, ‘bar’ => ‘something else’, ), $atts ); return “foo = {$a[‘foo’]}”; } add_shortcode( ‘bartag’, ‘bartag_func’ ); You … Read more

Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?

I think you are looking for this- function star_rating( $atts ) { $max = 5; $atts = shortcode_atts( array( ‘grade’ => $max, // default ), $atts ); $star_icons=””; $full_star = floor( $atts[‘grade’] ); for( $i=1; $i<=$full_star; $i++ ) { $star_icons .= ‘<i class=”fa fa-star”></i>’; } $half_star = 0; if( (int) $atts[‘grade’] != $atts[‘grade’] ){ $half_star … Read more

Shortcodes in RSS excerpts

I tested following code and it worked just fine for me: function my_name_shortcode( $atts ) { return “<h3>PRASAD</h3>”; } add_shortcode( ‘name’, ‘my_name_shortcode’ ); add_filter( “the_excerpt_rss”, “do_shortcode” ); The result can be seen in below screenshot.

Shortcode outputting at top of content

This happens when there is echoed output from the shortcode rather than the result being returned… I’d wager nt_course_note_entry_field likely echoes rather than returns. If there is one – or you can create one) – use a similar function like nt_get_course_note_entry_field that does not echo. If you can’t change the function you can wrap it … Read more