Create a short code that inserts js

Put the script into an external file, set the selector there and enqueue it from your shortcode: if(! function_exists (‘aisis_toc’) ) { function aisis_toc() { if ( ! is_singular() ) return; wp_enqueue_script( ‘jquery-toc’, plugins_url( ‘js/jquery-toc.js’, __FILE__ ), array ( ‘jquery’ ), NULL, TRUE); return; } }

shortcode change variable base on user

If this works for you in the template: $s=”[cfdb-table form=”Contact form 1″ show=”Submitted Login,your-email,your-message” search=”AndrewA”]”; echo do_shortcode($s); then you could try: global $current_user; get_currentuserinfo(); $s = sprintf(‘[cfdb-table form=”Contact form 1″ show=”Submitted Login,your-email,your-message” search=”%s”]’,$current_user->display_name); echo do_shortcode($s);

Multi-part form and wp_redirect()

You have a form like <form action=”http://some/url/form_two.php” method=”POST”> <input type=”whatever” value=”nothing” /> <input type=”hidden” name=”form_one_displayed” value=”1″ /> <input type=”submit” value=”Send” /> </form> in e.g form_one.php In form_two.php you validate the data that was send (or not) <?php $result = do_some_validation_with( $_POST ); if ( false == $result ) wp_redirect( ‘form_one.php’ ); else display_form_two(); function do_some_validation_with( … Read more

Change the default video URL in a post to shortcode format

To render the shortcode output with a clickable link while it still looks like a shortcode, you have to replace the built-in shortcode: add_shortcode( ‘video’, ‘wpse_96840_literal_video’ ); function wpse_96840_literal_video( $atts ) { $url = $atts[‘url’]; return ‘<code>’ . sprintf( ”, $url ) . ‘</code>’; } Result

How to wrap a text with shortcode into php file?

You can use the load_value ACF filter: function wpse0605_acf_load_field( $field ) { $field = ‘[box]’ . $field . ‘[/box]’; return $field; } // acf/load_field/name={$field_name} – filter for a specific field based on its name add_filter(‘acf/load_value/name=diorganwths_diagwnismou’, ‘wpse0605_acf_load_field’); add_filter(‘acf/load_value/name=apaitei_logariasmo_facebook’, ‘wpse0605_acf_load_field’); The code can go into the theme’s functions.php, or inside a plugin constructor.

Changing layout of defaul gallery output to masonry

try it like this: $.each($(‘.gallery img’), function () { var rndmnum = Math.floor((Math.random()*11)+1); rndmnum = rndmnum *20 + 260; $(this).css({ ‘max-width’ : rndmnum }); }); note: untested sources: https://stackoverflow.com/questions/8904707/javascript-random-number-between-15-and-225-increments-of-30 https://stackoverflow.com/questions/8733838/random-max-width-for-each-image-on-a-page edit: corrected calculation