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

Create shortcode for list of custom post titles with custom fields alongside

Try the following code: (I’ve not tested it, so there might be few things here and there, but you can get the overall idea): add_shortcode(‘boats’, ‘shortcode_boats’); function shortcode_boats($atts){ //merge the passed attributes with defaults extract( shortcode_atts( array( ‘post_type’ => ‘yacht-for-sale’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => 15, ‘caller_get_posts’ => 1 //i am not sure what you … Read more

Display only posts with comments

Since you are in a loop you can use the function get_comments_number(). Retrieves the value of the total number of comments, Trackbacks, and Pingbacks for a post. This tag must be within The Loop. Unlike comments_number() this function will return the value as a numeric value. Use it for example as follows: $num_comments = get_comments_number(); … Read more

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