Are .MP3 files with capital letter extensions allowed in [audio] shortcode?

No, apparently not. Until this behavior is changed in version 3.7 you can add this filter to your theme’s functions.php file to include additional extensions. Edited: I’ve updated the filter with better code suggested in the comments. Lower case and uppercase extensions function my_custom_audio_extensions( $exts ) { //merge array of upper case extensions with default … Read more

Super simple shortcode not working

Your problem is here: $welcomePage = get_post( 5 ); echo $welcomePage -> post_content; Shortcodes are processed on display by via a filter on the_content which is called by the function the_content(). You’ve bypassed that functionality and are echoing the raw post data. You need to output your code using a proper Loop or explicitly process … Read more

Making Quote Plugin more efficient

Is there more efficient ways to validate the quotes using the WordPress api? I think you should set a nonce for the form You also should check if current user has capability to save quote To get properly sanitize values form $_POST look at filter_input and/or filter_input_array I don’t see performance issues on validation, but … Read more

Can’t understand $atts in functions?

In general, if arguments is not used or the defaults values are to used of an argument/parameter, you don’t have to write it out, they can simply be omitted. The only time when you have to pass any value to an argument is when a function expect a valid value to be passed to it … Read more

Easy way to show excerpts of specific posts on a page

You need a couple of things. A shortcode handler, and a custom query: function wpse_186346_excerpt_length() { return 50; } function wpse_186346_excerpt( $atts ) { $atts = wp_parse_args( $atts, array( ‘posts_per_page’ => 2, // Any other default arguments ) ); // We don’t need paging, always save a query $atts[‘no_found_rows’] = true; // Create query based … Read more

Pass Shortcode Attribute to footer Script

It’s simple. WordPress have a handy function to send variables to a registered script. It’s wp_localize_script. It work this way: //First Register Your Script wp_register_script( ‘name-of-script’, ‘http://example.com/script.js’, ”, ”, true ); //Then send dynamic variables wp_localize_script( ‘name-of-script’, ‘globalVar’, array( ‘id’ => ‘slideTarget’ ) ); //Finally invoke it on Front-End wp_enqueue_script ( ‘name-of-script’ ); This should … Read more

Need to turn this php into WP shortcode

Init your shortcode add_shortcode(‘shortcode_ald_crp’, ‘myshortcode_echo_ald_crp’); The function what you want: function myshortcode_echo_ald_crp() { ob_start(); if ( function_exists( ‘echo_ald_crp’ ) ) echo_ald_crp(); return ob_get_clean(); } you call you shortcode in a post like this: [shortcode_ald_crp] Or into the php code: echo do_shortcode(‘[shortcode_ald_crp]’); UPDATE Change the function add_shortcode shortcode_ald_crp for myshortcode_echo_ald_crp

How to change the page break numbering?

Put this function in you functions.php – function the_dramatist_wp_link_pages( $args=”” ) { global $page, $numpages, $multipage, $more; $defaults = array( ‘before’ => ‘<p>’ . __( ‘Pages:’ ), ‘after’ => ‘</p>’, ‘link_before’ => ”, ‘link_after’ => ”, ‘next_or_number’ => ‘number’, ‘separator’ => ‘ ‘, ‘nextpagelink’ => __( ‘Next page’ ), ‘previouspagelink’ => __( ‘Previous page’ ), … Read more

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