How do I turn a shortcode into PHP code?

In general, inserting and executing shortcodes directly into templates files is not good idea and it is not what shortcodes are intented for. Instead, you should use the shortcode callback just like any other PHP function or template tag. For example, let’s imaging this shortcode: add_shortcode(‘someshortocode’, ‘someshortocode_callback’); function someshortocode_callback( $atts = array(), $content = null … Read more

What is a short code?

“Shortcode” is a user friendly way of inserting various WordPress plugins/scripts into a page without having to know a lot of fancy HTML/JavaScript/PHP in order to make it happen. Take, for example, embedding an mp3 file into a post on a hosted WordPress site. Instead of having to setup the proper code for a flash … Read more

Help with shortcode in admin-ajax [closed]

How you are applying a filter is wrong. You need to bind a function to the filter, but you are providing a variable. function my_filter( $content ) { return $content . ‘My added code’; } add_filter( ‘the_content’, ‘my_filter’ ); You should add the code like this, this should work.

Using Shortcodes in WP-Menus in WP 3.1 (via nav_menu_objects)?

The problem is that do_shortcode() expects a string in it’s first parameters while wp_nav_menu_objects get’s passed an array of menu objects. Sou you’d have to write your own wrapper function to do_shortcode, something like this… function my_nav_menu_objects_shortcode_mangler($items) { foreach ($items as $item) { $item->classes = explode(‘ ‘, do_shortcode(implode(‘ ‘, (array)$item->classes))); } return $items; } may … Read more

other shortcodes in Contact form 7 MAILS [closed]

WPCF7 incorporates more filters than used in the answer you already found. Analogously to that, the wpcf7_posted_data filter should do what you are looking for: function wpse73667_wpcf7_posted_data( $posted_data ) { $posted_data = do_shortcode( $posted_data ); return $posted_data; } add_filter( ‘wpcf7_posted_data’, ‘wpse73667_wpcf7_posted_data’ ); Note that this is an educated guess and untested. You can find all … Read more

How the widget can be run by shortcode

I think you are out of luck as wordpress core doesn’t have this kind of functionality. Quick googling shows that there are plugins to do that like this one http://wordpress.org/extend/plugins/amr-shortcode-any-widget/, but if you have programming skills you should probably write a shortcode handler with/instead of the widget.