Shortcode attribute “title” doesn’t appear in $atts array

It appears that you are not extracting your $atts correctly or at all for that matter. Use the correct procedure to get access to the passed attributes allong with setting up defaults as a fallback: extract( shortcode_atts( array( ‘shortcode’ => ‘default_value’, ‘title’ => ‘Default Title’, ), $atts ) ); There is infact an extensive guideline … Read more

Create plugin/function to catch XML-data via Shortcode

If this file is remotely available to you, then you should be using the HTTP API. $response = wp_remote_request( ‘http://xml.prisguide.no/productExport.php?productId=151690’ ,array( ‘ssl_verify’ => true // If the request isn’t working, try it with `false` ) ); You then simply go and catch the response and check if it’s an error: if ( is_wp_error( $response ) … Read more

wp_register_script and wp_register_style when shortcode is used

Your scripts and styles all share the same handle, “fancybox”, which should be unique, and I think that’s your issue. Try this: wp_register_script( ‘mousewheel’, get_stylesheet_directory_uri(‘/js/jquery.mousewheel-3.0.6.pack.js’, __FILE__), array(‘jquery’), ‘3.06’, true ); wp_register_script( ‘fancybox-script’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-pack’, get_stylesheet_directory_uri(‘/js/jquery.fancybox.pack.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( ‘fancybox-buttons’, get_stylesheet_directory_uri(‘/js/jquery.fancybox-buttons.js’, __FILE__), array(‘jquery’), ‘1.0’, true ); wp_register_script( … Read more

custom post types shortode stays on top of other page contents. Is there a bug?

You have this code in your shortcode function: if( count($posts) ): echo ‘<ul id=”portfolio-grid” class=”portfolio-grid unstyled ‘.$post_columns.’-cols”>’; foreach( $posts as $post ) : setup_postdata( $post ); ?> <li> <a href=”https://wordpress.stackexchange.com/questions/104016/<?php the_permalink(); ?>” data-largesrc=”<?php if ( has_post_thumbnail() ) { echo ub_featured_img_url(‘portfolio-fullsize’); } else { ?>http://placehold.it/600&text=<?php _e(‘No Thumbnails’, ‘une_boutique’); } ?>” data-title=”<?php the_title() ?>” data-button=”<?php _e(‘View Project’, … Read more

echo a shortcode in a shortcode code?

You will have to execute do_shortcode() on your $button. $ptoutput .= ‘<div class=”pt-buynow”><a href=”‘ . $url . ‘” class=”mt-button large”>’ . do_shrtcode( $button ) . ‘</a></div>’ . “\n”; Be aware of endless recursions! You may also check if the $button is set as a shortcode, if you want to force one. if ( !has_shortcode( $button, … Read more