Shortcode Attributes – post__not_in array

With this part: ‘post__not_in’ => array($custom_atts[‘hide’]) you’re actually running: ‘post__not_in’ => array( “7043,7128” ) with [customposts hide=”7043,7128″]. Note that post__not_in expects an array of numbers, not an array with a single CSV element. Have a look at e.g. wp_parse_id_list() and don’t forget to validate the input, to e.g. avoid empty input or a one with … Read more

What does this shortcode do?

In all honesty, it doesn’t do very much. If the code is literally as you describe, all it does is add fullstops either side of the content. If that’s not what happens then there’s likely missing code. As for the other parts: What is extract? extract is a PHP function used in a lot of … Read more

How i make a shortcode from this code

To make the inteire file a shortcode its at least something to considered, for that I would call the page instead. However a short code can be done like this. paste it in your functions.php if (! function_exists(‘my_custom_shortcode_with_the_name_I_had_choosen’)) { function my_custom_shortcode_with_the_name_I_had_choosen(){ … your code …. } } add_shortcode(‘whatever_name’, ‘my_custom_shortcode_with_the_name_I_had_choosen’); to a few more information check … Read more

Why My slider shortcode display above header

You need to return the value from the output buffer, like this: //slider shortcode function slider_shortcode($atts) { extract( shortcode_atts( array( ‘id’ => ”), $atts)); $id = $id; ob_start();?> <div class=”gallary”> <?php // Check rows exists. if( have_rows(‘slider’,$id) ): // Loop through rows. while( have_rows(‘slider’,$id) ) : the_row(); $slider_image = get_sub_field(‘slider_image’); $slider_heading = get_sub_field(‘slider_heading’); $slider_text = … 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

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

I’ve broken the short code for Contact Form 7!

From the codex: The shortcode parser uses a single pass on the post content. This means that if the $content parameter of a shortcode handler contains another shortcode, it won’t be parsed. http://codex.wordpress.org/Shortcode_API The codex also provides the solution to your issue, which is to use the funciton do_shortcode() If the enclosing shortcode is intended … Read more

Previous/Next with the same category

next_post_link() accepts a third argument which will limit the links to the same category. There is an example of this usage in the Codex: next_post_link( ‘%link’, ‘Next post in category’, TRUE ); in_same_term (boolean) (optional) Indicates whether next post must be within the same taxonomy term as the current post. If set to ‘true’, only … Read more

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