What is the latest WordPress that will work on PHP 5.2.17?

I think you’re looking at this the wrong way. Having an old application that requires such a archaic PHP version is bad enough. That does not mean, your new WordPress installation needs to use that same old version though. Instead, I would suggest to keep PHP 5.2.17 for the legacy application and use the latest … Read more

How to parse multiple links from one variable?

I would look into this question here https://stackoverflow.com/questions/36564293/extract-urls-from-a-string-using-php You could use the above link detection to do something like this in your shortcode: <?php function pods_current_user($atts) { extract(shortcode_atts(array( ‘currUser’ => get_current_user_id(), ), $atts)); extract(shortcode_atts(array( ‘field’ => “display_name”, ), $atts)); $message = do_shortcode(‘[pods name=”user” where=”ID = ‘.$currUser.'”] {@’.$field.’}[/pods]’); preg_match_all(‘#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#’, $message, $match); // Do something with your … Read more

wp_query get the 2nd post

I figured out you can use ‘offset’ => 1, to skip 1 post and get the 2nd. Change the number to however many posts you want to skip. ie. set it to 2 to get the 3rd. $loop = new WP_Query( [ ‘post_type’ => ‘product’, ‘posts_per_page’ => 1, ‘offset’ => 1, ‘meta_key’ => ‘total_sales’, ‘orderby’ … Read more

Find a way to retrive data updated through metabox plugin to web page

So finally I found a way to do that. Here is the code. page-contact.php <!– Contact Info –> <div class=”contact-info col-md-4 col-sm-4 margin-top-20 padding-left-20″> <label class=”contact-label pull-left width-wide”>Contact Info</label> <p><strong>IT’S SHOWTIME TOWING</strong><br /><br /> <!–Phone: <a href=”https://wordpress.stackexchange.com/questions/355497/tel:0450749863″>0450749863</a><br /><br /> –> Phone: <a href=”https://wordpress.stackexchange.com/questions/355497/tel:0450749863″><?php echo get_post_meta( $post->ID, ‘telNo’, true );?></a><br /><br /> <!–Email: <a href=”mailto:[email protected]”>[email protected]</a><br /><br … Read more

How to add apply_filter for a class property in plugin

Your problem has nothing to do with apply_filters, it’s a basic PHP mistake: public function init (){ $filter_fields = apply_filters(‘tbg_reg_fields’, $this->fields); } Here, you create a brand new variable in the init method scope named $filter_fields, then never use it. $this->filter_fields and $filter_fields are not the same. Additionally, because you used a filter and stored … Read more

Custom array from a query only write the last row of the query

This is because you’re not adding elements to the array. You’re overwriting them: $modified_result = array(); foreach($queryresult as $result){ $modified_result[‘name’] = $result->name; $modified_result[‘address’] = $result->address; } Your loop is setting the name and address property of the $modified_result array directly, and then replacing them for each item in the loop. You want $modified_result to be … Read more

List taxonomy term slugs within shortcode (do_shortcode)

The do_shortcode() function is currently in the foreach loop. I don’t know what are the parameters of this shortcode , but if it accepts comma separated values of term slugs: $terms = get_the_terms( $post->ID , ‘shoptype’ ); $i=1; $commaSeparatedvalues=””; foreach ( $terms as $term ) { $term_link = get_term_link( $term, ‘shoptype’ ); if( is_wp_error( $term_link … Read more

Where does “rel=0” get removed from my YouTube parameters?

Iframe content is generated by youtube itself, wordpress just requests it via oembed call. If you wish you can study wp-includes/class-oembed.php code, but that will not help you to change iframe parameters. For that you may apply embed_oembed_html filter, see https://developer.wordpress.org/reference/hooks/embed_oembed_html/. It receives iframe html code, so you can do some string replacements to change … Read more

How to set up a If is_singular statement?

is_single() and is_singular() are not the correct functions to use here. Your comment mentions that this is being added to search.php, but is_single() and is_singular() will always be false on search.php, because those functions are checking if the current page is a single post or page, but search.php is not. It’s is a list of … Read more