Shortcode in pages or tempate files for custom post type

Lucas Wynne linked some good plugins for such functionalities (I have used Addthis multiple times), however if you’re looking for a plugin-free solution, i’d more likely filter the content in my functions.php file instead of using a shortcode : some pseudo-code function add_content( $content ){ $content .= “<a href=\”facebook\”>FACEBOOK</a>”; return $content; } For more info … Read more

how to create a fav icon shortcode?

OK… as it sometimes goes i cant rest until i find a way and i found a way to get the fave icon to proeprly display using google 🙂 its really simple: // here i get my URL from my custom post type $directoryNoHttpUrl = get_post_meta( $post->ID, ‘directory_url’, true ); //here i clean the url … Read more

Show shortcode only in posts

If I understand the question: Modify the shortcode to incorporate <?php if (is_post()) { //do this; }?> or <?php if (is_page()) { //do this; }?> or <?php if (is_home()||is_front_page()) { //do this; }?> The first will only do //do this; on a post, the second on a page, and the third if the post or … Read more

Enclosing Shortcode not working in a Template

The shortcode wraps something in header tags. For the shortcode to work you need to provide that something. Your code above works fine, you just need to set $content=”My header text”; prior to echoing the shortcode in your template. currently you are not wrapping anything in the header tags. But you shouldn’t need to use … Read more

jQuery Tabs in Shortcode API

Try This: function defaulttab( $atts, $content = null ) { $GLOBALS[‘tab_count’] = 0; do_shortcode($content) if( is_array( $GLOBALS[‘tabs’] ) ){ $i = 1; foreach( $GLOBALS[‘tabs’] as $tab ){ $tabs[] = ‘<li><a class=”tab” href=”#”>’.$tab[‘title’].'</a></li>’; $panes[] = ‘<div class=”tab’.$i.'” class=”tabcontent”>’ .$tab[‘content’].'</div>’; $i++; } $return = ‘<div class=”tabcontainer”><ul class=”selector”>’.implode( “\n”, $tabs ).'</ul> <div class=”clear”></div>’.implode( “\n”, $panes ).'</div>’; } return … Read more

grab or load text on demand

You should really take a look at the AJAX in Plugins article. It gives examples of how to setup AJAX the proper way in WordPress. Here’s the basic workflow of using AJAX in WordPress: Create an enqueue your custom JavaScript file that uses jQuery.post or jQuery.get or jQuery.ajax Create a callback for the wp_ajax action … Read more

contact form 7 database short codes [closed]

The Codex page for is_plugin_active explains what your problem is: NOTE: defined in wp-admin/includes/plugin.php, so this is only available from within the admin pages. If you want to use this function from within a template, you will need to manually require plugin.php, like this: <?php include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ ); ?> <?php is_plugin_active($plugin) ?>

Shortcode not displaying video as expected

Had a bit of a brain wave and thought I would capture the output and return it in the function. Turns out it fixed the problem so the final code ended up looking like this: function amazon_video($atts){ extract( shortcode_atts( array( ‘file’ => $file ), $atts ) ); $url = get_bloginfo(‘url’); $return = “<embed src=””.$url.”/jwplayer/player.swf” name=”player” … Read more