Plugin that provides the [edit] shortcode?
A Google code search for “add_shortcode(‘edit'” gives me only one hit: Shailan Theme Framework, with an edit shortcode that places the edit link in your content. Probably not what you want?
A Google code search for “add_shortcode(‘edit'” gives me only one hit: Shailan Theme Framework, with an edit shortcode that places the edit link in your content. Probably not what you want?
add_shortcode(‘youtube’, ‘youtube_shortcode’); function youtube_shortcode($atts){ if(!isset($atts[0])) return; $id = strip_tags($atts[0]); ob_start(); ?> <div><a class=”fancybox” href=”#video_<?php echo $id; ?>”> <img src=”http://img.youtube.com/vi/<?php echo $id; ?>/0.jpg” alt=”Welcome To High Output” width=”220px” height=”120px” /></a></div> <div id=”video_<?php echo $id; ?>” style=”display: none;”> <iframe title=”YouTube video player” class=”youtube-player” type=”text/html” width=”480″ height=”390″ src=”http://www.youtube.com/embed/<?php echo $id; ?>” frameborder=”0″ allowFullScreen></iframe></div> <?php return ob_get_clean(); } use … Read more
First, need to lose query_posts() – it should never be used for secondary loops. Try something like this: $posts = get_posts( array( ‘cat’ => $category->term_id, ‘numberposts’ => 3, )); foreach( $posts as $post ) { $listing_code .= get_permalink( $post->ID ); //or whatever }
I think your problem is that your shortcode echos it’s output rather than returning it. So in your shortcode function, remove any direct output (that is stuff between ?>…..<?php and any echos and rather gather your output in a variable and return that: function my_shortcode_cb($atts) { …. $output = …. $output .= …. return $output; … Read more
You’re trying to execute PHP inside a string! Instead, concat the string; <?php echo do_shortcode( ‘[screenshot url=”‘ . get_the_title() . ‘”]’ ); ?>
Meta data is save in postmeta table and to get them you can use get_post_meta($post_id,’meta_key_name’,true); so in your shortcode function globilaize $post object and get you value like that if($something == “value”) { global $post; $one = get_post_meta($post->ID,’value_name’true); $two = get_post_meta($post->ID,’value2_name’true); }
Even after listening to the podcast this morning where Joel and Jeff talk about how “Fix my Code” questions are too localized to benefit the community and serve no purpose to anyone but the op, I’m going to try and answer this in a way that will be useful and beneficial to other weary WordPressors … Read more
how about something like <div id=”subscription”> <?php echo do_shortcode(‘[nggallery id=’.$ID.’]’);?> </div>
It looks like you’re using a php tag within a php tag. I’d try something more like this… <?php echo do_shortcode(‘[button type=”square” color=”black” size=”small”] Posted by ‘.get_the_author().’ [/button]’); ?> or something like this… <?php $shortcode=”[button type=”square” color=”black” size=”small”] Posted by “.get_the_author().’ [/button]’; echo “do_shortcode(‘$shortcode’)”; ?>
You should be able to use do_shortcode(), with a few modifications: <?php echo do_shortcode( ‘[sws_toggle3 title=”‘ . get_the_title() . ‘”]’ . get_the_content() . ‘[/sws_toggle3]’ ); ?> EDIT If you need to maintain the formatting of the_content(), simply pass get_the_content() through the appropriate filter: <?php $content = get_the_content(); $content = apply_filters( ‘the_content’, $content ); echo do_shortcode( … Read more