loop on page makes shortcode fail

You really shouldn’t use query_posts() for anything other than the main loop of that page and use either WP_Query() or get_posts(), try this: $my_query = new WP_Query( array( ‘category_name’ => ‘interesting_sites’, ‘posts_per_page’ => 3, ‘orderby’ => ‘rand’ ) ); while ($my_query->have_posts()){ $my_query->the_post(); ?> <div <?php post_class(); ?>> <h1><?php the_title(); ?></h1> <?php the_content(); ?> </div> <?php … Read more

How to attach sidebar to shortcode’s output?

I’m still not sure exactly what you’re trying to do, but here’s one possibility if it’s to display something like this: PAGE CONTENT | SHORTCODE/POSTS LOOP | SIDEBAR Do you have control of the shortcode content? If so, you could update it so its output is wrapped in a <div id=”shortcodecontent”> –shortcode post-loop output– </div>. … Read more

Can’t get default values to work with custom shortcode

extract takes and associative array and explodes it out in variables that reflect the array key names. $atts[‘height’] would just be $height, in other words. The relevant two lines of your code would become: <param name=”type” value=”video/quicktime” height=”‘.$height.'” width=”‘.$width.'”> <embed src=”‘.$url.'” height=”‘.$height.'” width=”‘.$width.'” autoplay=”false” type=”video/quicktime” pluginspage=”http://www.apple.com/quicktime/download/”> If you did still want to use the indexing, … Read more

Shortcode Attribute

yeah, you are kind in the right path, just need to know that the ‘title’ is a variable that will get and past the value, so you have to call it exactly where you wrote “DO I NEED SOME TEXT HERE”, so it goes like this: function column_shortcode( $atts, $content = null ) { extract(shortcode_atts(array( … Read more

add php shortcode in return function

Do not call do_shortcode(). Use the associated handler instead. And if you want to call the shortcode without parameters you have to make the parameters optional in the handler’s declaration: function custom_slidessc($atts = array(), $content = null) So what you need is: return ‘<img>’ . custom_slidessc();

WordPress do_shortcode first iteration

Figured out both issues. You can keep a count and find out when you are on the first iteration in the same go. static $count; if(!$count) { $count = 1; $state=” active”; } else { $count++; $state=””; } From the PHP Manual. “A static variable exists only in a local function scope, but it does … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)